r/PostgreSQL • • 16h ago

Projects plx: The Excellent Transpiler 3.1.0 releasd

1 Upvotes

plx is a PostgreSQL extension. When you run CREATE FUNCTION ... LANGUAGE plx*, plx transpiles the body to plpgsql and stores that plpgsql in pg_proc.prosrc. At run time the function is executed by PostgreSQL's own plpgsql interpreter. There is no separate language runtime loaded into the backend, the generated plpgsql is visible in the catalog, and every plpgsql construct is reachable from every dialect.

[3.1.0] - 2026-11-21

3.1.0 adds two dialects, plxlua and plxcsharp. Nothing that 3.0.0 does changes: functions in the other dialects transpile as before.

Added

  • plxlua, a Lua dialect (LANGUAGE plxlua). Lua's keyword-end blocks, local declarations with type inference and --:: annotations, <const>, if/elseif, while, repeat ... until, the numeric for (any step) and for ... in query(...) / ipairs(...), the goto continue idiom, and return into OUT parameters. Errors are raised with error(...), error{message = ..., sqlstate = ...}, assert and print, and handled with pcall(function() ... end), whose err carries err.sqlstate and the other diagnostics fields. In expressions: .., ~=, nil, #, table constructors as arrays, //, and the x or d, c and a or b and c and v or d idioms, with a subset of the string, math and table libraries. Locals keep Lua's block scope, and s = s .. e uses the string builder. See doc/plxlua.md.
  • plxcsharp, a C# dialect (LANGUAGE plxcsharp). Declarations put the type first and C# types map to PostgreSQL types (int to integer, string to text, decimal to numeric, DateTime to timestamp, T[] to arrays); var takes the type of its value. Regular, verbatim (@"..."), raw ("""...""") and interpolated ($"...") strings work, and an interpolated string passed to query, execute and the other SQL intrinsics is a SQL template whose values are bound. + is string concatenation when an operand is known to be a string. Statements: if, while, do/while, for, foreach over a query, an array or a string, switch and switch expressions, try/catch/finally with exception classes and when (e.SqlState == ...) filters, throw, yield return for set-returning functions, Console.WriteLine as RAISE NOTICE, and StringBuilder and s += x on the string builder, with a set of mapped .NET members (string, Math, Convert, DateTime, Guid, ...). See doc/plxcsharp.md.
  • make oraclecheck runs plxlua and plxcsharp programs and compares their results with what real Lua and C# print for the same programs.

r/PostgreSQL • • 15h ago

Projects How to check whether anyone on the internet can read your Supabase tables

Thumbnail reddit.com
0 Upvotes

r/PostgreSQL • • 21h ago

Commercial Running 19 integration & concurrency checks against a real PostgreSQL 18 DB instead of mocking SQL

0 Upvotes

Mocked queries in unit tests are fast, but they miss real lock contention, transaction ordering, and constraint behavior when multiple requests hit the database at once.

While hardening a multi-tenant backend (27 test files / 131 tests total, plus 19 integration and concurrency checks) against an isolated PostgreSQL 18 instance, testing against real Postgres caught edge cases around concurrent mutations, rate-limit counters, and webhook/state transitions that mocked unit tests never surfaced. The attached 26-second clip shows the test suite passing and moves straight into the live workspace.

For those running integration or concurrency tests against real Postgres: how do you isolate state between test runs (per-test transactions, fresh schema/DB, or reset scripts) while keeping execution times fast?