Skip to content

plx 3.1.0

Latest

Choose a tag to compare

@jdatcmd jdatcmd released this 21 Nov 01:25
a3c453c

Adds two dialects: plxlua (Lua) and plxcsharp (C#). Nothing that 3.0.0 does changes: functions in the other dialects transpile exactly as before.

Upgrading from 3.0.0

You need superuser access to each database that has plx.

  1. Install the new build on the server.

  2. Restart the server, or start new sessions, so that they load the new build.

  3. In each database that has plx, run:

    ALTER EXTENSION plx UPDATE;

    The update adds the two languages and their handler functions, and changes no existing object.

From 2.0.0, the same command updates through 3.0.0 to 3.1.0; read the 3.0.0 release notes first.

The new dialects

  • plxlua:
    • Lua's blocks, local with type inference and --:: annotations, and every loop form: numeric for, ipairs, query(...), while and repeat.
    • pcall/error for exceptions, and a subset of the string, math and table libraries.
    • Block-scoped locals.
    • See doc/plxlua.md.
  • plxcsharp:
    • Type-first declarations and C# string forms, including interpolated strings that bind their values in SQL.
    • try/catch/finally with exception classes and when filters.
    • Switch expressions, foreach over queries and arrays, yield return, StringBuilder, and a set of mapped .NET members.
    • See doc/plxcsharp.md.

Both run as TRUSTED languages and follow 3.0.0's rules:

  • interpolated values are bound as parameters;
  • plx's objects are schema-qualified;
  • USAGE on plpgsql is required;
  • declared types are checked;
  • nesting, interrupts and string quoting are guarded.

Each chapter's "Semantic differences" section lists where a result differs from real Lua or C#.

Verification

  • CI: green on PostgreSQL 13 through 18.
  • Locally:
    • 26/26 installcheck;
    • the differential check with no unexplained divergence;
    • 300/300 finally cases for plxpython3 and for plxcsharp;
    • 39/39 corpus programs;
    • make upgradecheck, including 3.0.0 to 3.1.0 matching a fresh install;
    • a new make oraclecheck, which compares 55 Lua and C# programs with the output of real lua5.4 and .NET 8;
    • fuzzing with no crash.
  • Review: eight rounds of adversarial review; the last found no correctness defect.