mirror of https://github.com/sysown/proxysql
Follow-up to the cluster-2 ParserSQL 1.0.3 bump (this same PR),
addressing review feedback from coderabbit + gemini.
## 1. PgSQL_Session: accept multi-value SET vectors (coderabbit, Major)
The previous commit `5a48004af` taught the adapter to walk every RHS
sibling so PG multi-value lists (e.g. `SET search_path TO "$user",
public`) come through as a `std::vector<std::string>` of every value.
But `lib/PgSQL_Session.cpp:4516` still had `size() > 2` →
`unable_to_parse_set_statement()`, which would have caused 3+ value
PG SETs to lock the hostgroup instead of being processed. Worse,
the downstream value-consumer at the same site used only
`it->second.front()`, silently dropping every value past the first
for valid 2-value SETs too.
Fix:
* Drop the upper bound from the cardinality check (keep `< 1` so
empty value lists still fail loudly).
* Join every value in the vector into `value1` with the
comma-separated form PG itself uses for these parameters
(`a, b, c`). Single-value SETs hit the loop with `size()==1` and
take just `it->second.front()`, preserving the previous behaviour.
The validator / hash-compare / tracker / param_status code below the
join is unchanged — it now receives the full joined value instead of
the truncated first element.
## 2. setparser_parsersql_test: drop INTERVAL test that locked in
incomplete behaviour (subagent correctness review, Major)
`parsersql_pgsql_time_zone` previously asserted that
`SET TIME ZONE INTERVAL '7' HOUR` produces `timezone = "INTERVAL"`,
which is the *current* observable output of ParserSQL — the
expression parser does not yet consume the `'7' HOUR` modifier
chain. Encoding that as expected output would flip the test red
when ParserSQL is later improved to capture the full interval
expression, conflating an improvement with a regression.
Removed the case; left a comment in the fixture explaining the gap
so a future contributor adds the case back together with the
ExpressionParser fix.
## 3. Diag-output cleanup (gemini, cosmetic)
* `%lu` → `%zu` for `size_t` (portability — `size_t` is not always
`unsigned long` on 32-bit / Windows).
* Extract the per-vector " | "-separated diag-string builder into
a single `join_values_for_diag()` helper used by both
`TestParse` (now also dumps full vector on mismatch, where it
previously printed just `vals[0]`) and `TestParsePgsql`.
## Verification
* `./setparser_parsersql_test`: 260/270 ok; the 10 remaining
not-ok are unchanged pre-existing failures (`sql_mode 23-25`,
`Set1_v2 0-1`), nothing new from this commit.
* `pgsql_time_zone` group: 6 assertions (3 cases × 2) — confirms
the INTERVAL case is removed cleanly.
* `pgsql_search_path` group: 16 assertions still all pass — the
multi-value join in PgSQL_Session does not affect the parser-
side test (which goes through the adapter, not the session).
fix/parsersql-1.0.3-pg-set-fixes
parent
e668a9ddac
commit
4eb52abf2c
Loading…
Reference in new issue