Skip to content

plx 1.1

Choose a tag to compare

@jdatcmd jdatcmd released this 15 Jul 02:04

plx 1.1 adds plxcobol, a COBOL dialect (ISO/IEC 1989:2023, COBOL 2023, free
format), at full plpgsql construct parity. As with the other dialects, a COBOL
function body is transpiled to plpgsql at CREATE FUNCTION time and runs on the
standard plpgsql interpreter, with no separate language runtime in the backend.

plxcobol

COBOL is verb-driven and free-format, so it has its own front end (tokenizer and
recursive-descent parser). Data names map to plpgsql identifiers (lower-cased,
hyphens to underscores). Coverage:

  • WORKING-STORAGE declarations, with PICTURE mapped to SQL types, plus TYPE
    (for %ROWTYPE, RECORD, refcursor) and CONSTANT AS.
  • MOVE / COMPUTE and the ADD / SUBTRACT / MULTIPLY / DIVIDE verbs;
    ** is exponent and % is modulo.
  • IF / ELSE / END-IF; EVALUATE (simple and searched EVALUATE TRUE).
  • PERFORM in the UNTIL, VARYING, TIMES, inline, query (OVER "sql") and
    array (OVER ARRAY) forms; EXIT PERFORM [CYCLE].
  • GOBACK RETURNING, RETURN-NEXT, RETURN-QUERY; EXECUTE with USING/INTO;
    cursors (OPEN-CURSOR/FETCH-CURSOR/MOVE-CURSOR/CLOSE-CURSOR).
  • Exception handling (BEGIN-TRY/WHEN/END-TRY) with stacked diagnostics via
    GET; GET ROW-COUNT; FOUND.
  • STRING-APPEND <expr> TO <var>, which lowers to the plx_strbuild string
    builder (amortized-O(1) in-loop string building).
  • RAISE, DISPLAY, ASSERT, CALL, COMMIT/ROLLBACK.

See doc/plxcobol.md
and the parity matrix in
doc/PARITY.md.

Performance

plxcobol transpiles to plpgsql like the other dialects, so it matches plpgsql on
the arithmetic, iteration, string-building, and call workloads; see
bench/BENCHMARKS.md.

Upgrading

Existing 1.0 installations upgrade in place:

ALTER EXTENSION plx UPDATE TO '1.1';

A fresh CREATE EXTENSION plx installs 1.1 directly.

Compatibility

Tested against PostgreSQL 13 through 18; the full regression suite (nine suites,
including plxcobol) passes on each.