fix(test): update pgsql digest fixtures for typecast trailing-space behavior

PR #5755 (commit e6bef5c58) fixed `process_pg_typecast()` in
`lib/pgsql_tokenizer.cpp` so that the trailing space after a PG
typecast is preserved unless the next non-space character is a
modifier `(` or array bracket `[`.  The commit message documented
this as an intentional behaviour change:

    "The new lookahead-conditional skip preserves the trailing
     space unless the very next non-space character is a modifier
     `(` or array bracket `[`."

Three test cases in `tokenizer_payloads/pgsql_regular_tokenizer_digests.hjson`
hardcoded expected digests against the OLD (buggy) tokenizer output,
where the space-eating bug glued the preceding literal to the
following operator.  With the fix in place those expectations
mismatch, making `pgsql-query_digests_stages_test-t` fail
deterministically in the legacy-g4 TAP group on v3.0 HEAD:

  * `::json  ->  'key'`  STAGE 1: actual `select ? -> ?`   vs old expected `select ?-> ?`
  * `::jsonb @>  ...`    STAGE 1-4: actual `select ? @> ?` vs old expected `select ?@> ?`
  * `::money +  ...`     STAGE 1: actual `select ? + ?`    vs old expected `select ?+ ?`

For `->` and `+`, only STAGE 1 changes — STAGE 2-4's existing
whitespace-collapse step still glues `?->` and `?+` for those
operators, so `s2`/`s3`/`s4` expectations stay as-is.  For `@>`,
none of the stages collapse the space, so all four expectations
move.

The new actual digest output is the more correct one — it mirrors
the existing MySQL tokenizer's behaviour for the same shape, where
`'literal' + 'literal'` already produces `? + ?` at STAGE 1.  This
commit only updates the fixture; no tokenizer or test source
changes.

Verified locally against the existing test binary (built from
v3.0 HEAD, includes the new tokenizer behaviour):

    ./pgsql-query_digests_stages_test-t  →  734/734 ok, RC=0

The 9 previously-failing assertions (#381, #385, #389-#392, #592,
#596, #600) all flip to ok with the updated fixture.
fix/parsersql-1.0.3-pg-set-fixes
Rene Cannao 1 month ago
parent 5a48004af5
commit e668a9ddac

@ -278,7 +278,7 @@
"select '{\"key\":\"value\"}'::json -> 'key'",
"select '[1,2,3]'::json -> 1"
],
"s1": "select ?-> ?",
"s1": "select ? -> ?",
"s2": "select ?-> ?",
"s3": "select ?-> ?",
"s4": "select ?-> ?"
@ -288,10 +288,10 @@
"q": [
"select '{\"key\":\"value\"}'::jsonb @> '{\"key\":\"value\"}'"
],
"s1": "select ?@> ?",
"s2": "select ?@> ?",
"s3": "select ?@> ?",
"s4": "select ?@> ?"
"s1": "select ? @> ?",
"s2": "select ? @> ?",
"s3": "select ? @> ?",
"s4": "select ? @> ?"
},
// ========================
// SECTION 8: DOLLAR PARAMETERS
@ -656,7 +656,7 @@
"select '$1,000.00'::money + '$12.34'::money",
"select '12.34'::money + '5.66'::money"
],
"s1": "select ?+ ?",
"s1": "select ? + ?",
"s2": "select ?+?",
"s3": "select ?+?",
"s4": "select ?+?"

Loading…
Cancel
Save