plx: Write PostgreSQL Stored Functions in Ruby, PHP, JS, or Python
plx transpiles Ruby, PHP, JS, and Python-like syntax into plpgsql, giving PostgreSQL developers familiar dialects with trusted, native performance.
plx is a PostgreSQL extension that lets developers write stored functions and triggers using Ruby-, PHP-, JavaScript-, or Python-like dialects. When CREATE FUNCTION runs, the body is transpiled into plpgsql and stored in pg_proc.prosrc; at execution time, PostgreSQL's native plpgsql interpreter runs it directly — no extra language runtime is loaded into the backend.
This sidesteps the usual costs of untrusted procedural languages like plpython3u or plperlu, which require loading a full interpreter, are typically superuser-only, and marshal every row across an SPI boundary. With plx, translation happens once at function-creation time; at runtime there's no extra layer beyond what plpgsql already does.
Four dialects are available today — plxruby, plxphp, plxjs, and plxpython3 — and every plpgsql statement type is reachable from each. The generated plpgsql is visible in pg_proc.prosrc, fully inspectable, and dumpable via pg_dump, rather than hidden inside an opaque runtime. Benchmarks show plx dialects perform within about 11 percent of native plpgsql and significantly outperform embedded-interpreter PLs on row iteration.
For teams standardizing on PostgreSQL, plx offers a practical bridge: familiar application-language syntax with plpgsql's trusted execution and performance profile, without asking developers to learn a new procedural language first.
This synthesis was produced from its source by AI; there is no human editor or manual review step. How we work