Repository navigation
fix(deparser): ALTER STATISTICS IF EXISTS / DEFAULT and quoted operator schema names - #404
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Review complete. No issues found — approved ✅. The change extends the deparser with correct handling of two SQL constructs that previously failed to deparse. The operator-name path distinguishes single-part names (rendered raw, since PG operator symbols are never quoted) from multi-part names (schema parts quoted, emitted via the
Reviewed commit: 0caf67d |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
Devin Review found 1 finding. Devin automatically fixed it.
Fixed by Devin (1)
- Legacy statistics zero becomes DEFAULT — v16-to-v17 now maps the legacy int target (absent = 0) to an Integer node, matching how PG17 parses SET STATISTICS 0, so DEFAULT is only emitted for a genuinely absent PG17+ target; covered by a direct transformer test.
Summary
Redoes the remaining pieces of #370 fresh on main (the stats renaming part already landed in #391).
AlterStatsStmt: emitsIF EXISTSwhenmissing_ok, andSET STATISTICS DEFAULTwhenstxstattargetis absent (PG 18 represents DEFAULT as a null target). Previously both were dropped.deparseOperatorName: qualified operators now go through the existingqualifiedOperatorNamehelper (schema parts viaQuoteUtils.quoteIdentifier, operator symbol as is) instead of a rawjoin('.'), soOPERATOR("My Schema".+)no longer deparses toOPERATOR(My Schema.+).Fixtures:
__fixtures__/kitchen-sink/misc/{alter-statistics,operator-names}.sqlwith regeneratedgenerated.jsonand kitchen-sink tests. Two regression-corpus cases now pass and were removed fromknown-failures.deparser.json.Not in scope: separate pre-existing quoting bugs in
ORDER BY … USINGand exclusion-constraint operators.Implemented in session Redo ALTER STATISTICS and operator name deparsing
Review with Devin · Open in Devin Desktop
Summary by CodeRabbit
ANYorALL.ALTER STATISTICSoutput now correctly includesIF EXISTSandDEFAULTwhere specified, including when the statistics target is zero.ALTER STATISTICSstatements now retain their target values, including zero and negative values, when transformed for PostgreSQL 17.