Skip to content

plx 1.3.2

Choose a tag to compare

@jdatcmd jdatcmd released this 24 Aug 23:50
· 11 commits to master since this release
3f74de2

Code-only patch release (no catalog changes). Upgrade with ALTER EXTENSION plx UPDATE TO '1.3.2' after installing the new module.

Fixed

  • plxgo fmt.Sprintf. In expression position fmt.Sprintf passed its Go format string straight into SQL format(), which understands only %s, %I, %L and %%. Every other verb raised unrecognized format() type specifier when the function was called. The transpile succeeded and the failure only appeared at run time, so fmt.Sprintf("%d", n), the ordinary way to format an integer in Go, produced a function that could not run. Go's verbs are now rewritten to the %s that format() understands, keeping a - flag and a width. A % that starts no directive is escaped rather than passed through, since a lone % is itself an error to format().

    The verbs that change an operand's representation rather than its padding render what %s renders, so fmt.Sprintf("%x", 255) yields 255 and not ff. Convert explicitly where the representation matters. Recorded in the Go chapter and in the limitations page.

Added

  • make differentialcheck. Each case is one small program written once as a plpgsql reference and once per dialect, then called with the same arguments. The reference is the plpgsql a PostgreSQL developer would have written for the same logic, so a disagreement is a defect rather than a difference of opinion. Values are compared by text form with NULL distinguished from the empty string, and a case that raises must raise the same SQLSTATE. Intended divergences are recorded per case with a reason, and the check fails if a recorded divergence stops happening, so a documented limitation cannot outlive its documentation. This is what found the Sprintf bug above.
  • A migration page, comparing plx against rewriting by hand, an embedded PL, ora2pg, and leaving the logic in the application, including how to leave plx while keeping the generated plpgsql: https://commandprompt.github.io/plx/MIGRATION/

Changed

  • The internal transpiler refactor behind a PlxSurface.parse_body vtable, and its follow-up cleanups. No functional change; generated plpgsql is byte-identical.

Verification

CI green on PostgreSQL 13 through 18. On 18.4: clean build with no warnings, 13/13 installcheck, differentialcheck at 374 matching and 14 documented. ALTER EXTENSION plx UPDATE TO '1.3.2' from 1.3.1 applies and carries the fix, and a fresh CREATE EXTENSION plx installs 1.3.2.