|
| 1 | +# PostgreSQL SELECT and CTE coverage increment |
| 2 | + |
| 3 | +Continue the user-approved grammar expansion on PR #67. Execute inline, retain |
| 4 | +MySQL behavior and the 48-byte AST layout, and exclude all benchmark files from |
| 5 | +commits. Preserve syntax in ASTs and emitted SQL; reject newly parsed features |
| 6 | +in the local engine unless its existing implementation supports them. |
| 7 | + |
| 8 | +1. Add failing PostgreSQL expression tests for qualified/quoted function names, |
| 9 | + DISTINCT/ALL aggregates, aggregate ORDER BY with direction/null placement, |
| 10 | + WITHIN GROUP, composition with FILTER/OVER, malformed argument boundaries, |
| 11 | + and parameterization of aggregate sort constants (which are not ordinals). |
| 12 | +2. Implement expression parsing and emission with node-specific flags and an |
| 13 | + appended aggregate order node. Retain ordinary function argument children. |
| 14 | +3. Add failing CTE tests for output columns, VALUES/TABLE/compound bodies, |
| 15 | + nested WITH, materialization hints, and strict delimiters. Preserve the body |
| 16 | + as the first definition child and explicit columns as a separate child. |
| 17 | + Add CTE emission and guard unsupported execution. DML CTEs remain deferred |
| 18 | + if their integration requires changes beyond this query-focused increment. |
| 19 | +4. Force rebuild and run full C++ tests, corpus harness, and PostgreSQL oracle |
| 20 | + comparisons. Inspect transitions before refreshing correctness snapshots. |
| 21 | +5. Obtain an independent code review, document behavior and remaining gaps, |
| 22 | + make detailed commits, push the branch, and update PR #67. |
| 23 | + |
| 24 | +Review focus: quoted names, call versus column ambiguity, missing delimiters, |
| 25 | +aggregate order constants versus SELECT ordinals, CTE child layout and engine |
| 26 | +materialization behavior. Do not equate complete parsing with AST equivalence. |
| 27 | + |
| 28 | +## Progress and review |
| 29 | + |
| 30 | +- Qualified calls, aggregate modifiers/order and CTE composition implemented. |
| 31 | + Focused tests first demonstrated the missing syntax, then passed. |
| 32 | +- Ruling: extend the shared PostgreSQL subquery callback and its entry checks |
| 33 | + to support VALUES/TABLE/WITH in derived tables and scalar subqueries. This |
| 34 | + avoids different grammars for the same query in CTE and derived contexts. |
| 35 | +- Review exposed malformed EXISTS null dereference, quoted CTE name emission, |
| 36 | + incomplete operand acceptance in nested queries, duplicate bare WITH, ALL |
| 37 | + WITHIN GROUP acceptance, and aggregate star restrictions. Added regressions |
| 38 | + and corrected each against pinned PostgreSQL grammar. |
| 39 | +- Ruling: add NULLS FIRST/LAST in compound-query ordering because shared |
| 40 | + subquery parsing must preserve ordering clauses. Unsupported local execution |
| 41 | + remains explicitly rejected. |
| 42 | +- Review demonstrated physical-table shadowing when unsupported CTE bodies were |
| 43 | + skipped during execution. Reject VALUES/TABLE query bodies and nested CTE |
| 44 | + materialization before execution, with an executor regression test. |
| 45 | +- Final corpus replay: 27,014 complete parses (+771), no previously complete |
| 46 | + case lost. Gains: 638 SELECT, 123 EXPLAIN, nine UPDATE and one INSERT. Another |
| 47 | + 79 trailing and 42 type-mismatch results now report explicit errors; these |
| 48 | + remain unsupported queries, not lost complete parses. |
| 49 | +- Forced full rebuild: 1,381 passing C++ tests, 37 backend skips; corpus harness |
| 50 | + built. Focused sanitizer run: 52 passing tests. All 24 new original/emitted |
| 51 | + PostgreSQL AST pairs match after source locations are removed. |
| 52 | +- Independent final review: no outstanding findings after 20 targeted grammar |
| 53 | + checks and three CTE physical-table shadowing reproductions. |
| 54 | +- Correctness snapshot refresh and PR publication follow the grammar commit. |
0 commit comments