Skip to content

ParserSQL 1.1.1

Latest

Choose a tag to compare

@renecannao renecannao released this 11 Oct 16:18
c7adfcb

ParserSQL 1.1.1 is a correctness release for SET ... TRANSACTION and several PostgreSQL SET forms. In 1.1.0, emitted SQL and digests could lose content or change meaning.

Fixes

  • MySQL SET [GLOBAL|SESSION|LOCAL|PERSIST|PERSIST_ONLY] TRANSACTION: the scope is kept. Before this release, every scope was emitted as plain SET TRANSACTION.
    • Every characteristic is parsed, not only the first one.
    • READ ONLY is no longer misread as an isolation level.
    • Whitespace, newlines, comments and keyword case are normalized in NORMAL and DIGEST output.
  • MySQL statements that mix TRANSACTION with other SET items (in either order) are now a parse error, as on MySQL 8.4, MySQL 5.7 and MariaDB 10.11. Before, they were accepted with only part of the input parsed. Valid mixes such as SET NAMES utf8mb4, sql_mode='x' still parse.
  • PostgreSQL transaction forms:
    • SET SESSION CHARACTERISTICS AS TRANSACTION ... is kept distinct from SET SESSION TRANSACTION .... The new FLAG_SET_TRANSACTION_CHARACTERISTICS flag marks it.
    • SET LOCAL TRANSACTION ... and SET TRANSACTION SNAPSHOT '...' now parse.
    • All transaction modes are parsed.
  • PostgreSQL SET ROLE, SET SESSION AUTHORIZATION and SET CONSTRAINTS: emitted in full. Before, the output was an empty SET .
  • PostgreSQL multi-value assignments (SET search_path TO a, b, including with SESSION or LOCAL): all values are kept.

AST / API changes

  • NODE_SET_TRANSACTION stores each characteristic as its own NODE_TRANSACTION_OPTION child, with a canonical value (for example ISOLATION LEVEL READ COMMITTED or READ ONLY). This is the same node type used for BEGIN / START TRANSACTION.
  • The optional first child is the scope, as a NODE_IDENTIFIER with a canonical uppercase value. source keeps the original spelling.
  • SetParser<D>::parse() returns ERROR for a SET statement that mixes TRANSACTION with other items.

Migration notes

  • Digest text changes for the statements above. Review query rules and stats keyed on the old digests. The old digests were:
    • SET TRANSACTION ... for every scoped form.
    • SET for PostgreSQL ROLE, SESSION AUTHORIZATION and CONSTRAINTS.
    • Only the first value of a multi-value search_path.
  • Consumers that walk the old NODE_IDENTIFIER characteristic children must switch to NODE_TRANSACTION_OPTION.

Validation

  • make test: 1,790 tests passed; 37 backend-dependent tests skipped.
  • PostgreSQL harness: 87 unit tests and 5,122 committed compatibility cases passed. Six baseline rows improved from TRAILING_INPUT to DEEP_SUPPORTED.
  • MySQL harness: 545 curated cases, 0 mismatches.
  • Each changed form was checked against MySQL 8.4.8 (PREPARE) and libpg_query 18.
  • CI on #71 passed all regular jobs. The release commit has the same source tree as the tested PR revision.

Full changelog

Release commit: c7adfcb1d578f3121f876bebf2ee5b4978cbf7af.