Repository navigation
Conversation
CREATE TABLE ON COMMIT and USING clauses were split into one raw TableOption per word. Parse them as Kind.ON_COMMIT with a typed OnCommitAction and as Kind.ACCESS_METHOD; the legacy token lists and SQL output are unchanged. ALTER TABLE DROP [COLUMN] c RESTRICT was rejected. AlterExpressionDrop now keeps CASCADE/RESTRICT as a CascadeBehavior for column and constraint drops, and getParameters() still lists the keyword. Signed-off-by: minleejae <mmj9808@gmail.com>
This was referenced Oct 14, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
PostgreSQL temporary-table and access method clauses parse today, but each word becomes its own table option. A caller that wants the
ON COMMITaction ofCREATE TEMP TABLE t (a INT) ON COMMIT DELETE ROWShas to reassemble four raw options.ALTER TABLE … DROP [COLUMN] c RESTRICTfails, while the same statement withCASCADEparses.Current design (As-is)
CreateTableOptionhas typed alternatives forWITH (…),WITHOUT OIDSand the MySQL options. Other clauses fall back toCreateParameter, so each token becomes aKind.OTHERoption:ON COMMIT DELETE ROWS: 4 options (ON,COMMIT,DELETE,ROWS);ON COMMIT DROP: 3 options;USING heap: 2 options, also inCREATE TABLE … USING heap AS SELECT ….CASCADE/RESTRICTas raw strings ingetParameters(). The column form accepts onlyCASCADE(and Oracle'sCASCADE CONSTRAINTS).Target design (To-be)
TableOption.Kind.ON_COMMIT.TableOption.OnCommitActionenum holdsPRESERVE_ROWS,DELETE_ROWSandDROP. It also holds Oracle's private temporary table actionsPRESERVE_DEFINITIONandDROP_DEFINITION, which were accepted as raw tokens before.getOnCommitAction()/setOnCommitAction()and theTableOption.onCommit(action)factory follow the replacement rules of Make table option state transitions explicit #2765: raw tokens discard the action, and the setter replaces the option's contents.Kind.ACCESS_METHOD, with nameUSINGand the method as its value.String, as inCreateView.getAccessMethod()andALTER TABLE … SET ACCESS METHOD.CREATE TABLE … ASand, withDialect.POSTGRESQL, afterPARTITION BY.TableOption.accessMethod(name).CreateTableOption, and a newOnCommitTableOption()production next to it.PRESERVEandDEFINITIONare matched as contextual keywords.USING INDEX TABLESPACEstays a raw option.ON COMMITandON COMMIT DELETEare now rejected.AlterExpressionDrop.getBehavior()returns the sharedCascadeBehavior(Consolidate CASCADE/RESTRICT enums (breaking API change) #2745).CONSTRAINT,PRIMARY KEY,UNIQUE (…)andFOREIGN KEY (…)drop forms, so every DROP action in the class uses the same field. The grammar reuses the existingCASCADE | RESTRICTproduction.CASCADE CONSTRAINTSandINVALIDATEremain raw parameters, and their order is preserved.CreateTable.getTableOptionsStrings()andTableOption.getTokens()return the same word tokens as before (ON,COMMIT,DELETE,ROWS;USING,heap). SQL output is unchanged.Kind.OTHERoptions for these words now finds one typed option instead.AlterExpressionDrop.getParameters()still ends withCASCADEorRESTRICT. When a behavior is set, it returns a read-only snapshot; change the clause withsetBehavior.usage.rstdocuments the new kinds and the DROP behavior.Validation
PostgreSqlTableOptionsTest(18):toString, deparser and reparse withDialect.POSTGRESQLand without a dialect, plus statement boundaries;CREATE TABLE … AS;USING INDEX TABLESPACEand rejectedON COMMITforms;AlterDropBehaviorTest(20):RESTRICT/CASCADEon column and constraint drops, with and withoutCOLUMN/IF EXISTS;getParameters();spotlessApply check: 10,392 tests, 10,367 passed, 25 skipped, zero failures/errors. The grammar choice conflict check passes.master(bdf8ac31) on a corpus of 635 MySQL 8.4 and PostgreSQL 18 DDL/DCL statements, each accepted by the server, plus variants:ALTER TABLE … DROP a, DROP COLUMN b RESTRICT(withDialect.POSTGRESQLand without a dialect) and twoDROP [COLUMN] … RESTRICTvariants. 0 regressions; no other case changed status or statement class.ON COMMIT DROP,USING heapandON COMMIT DELETE ROWSnow hold one typed option each, with identicaltableOptionsStrings.DROP … CASCADEactions moveCASCADEfrom the raw parameter list tobehavior;getParameters()is unchanged.toString()on a second, identical server, in the same order. All 205 MySQL and 329 PostgreSQL statements give the same result (success, or the same error).Integration validation
Applied #2806–#2819 together on
master(bdf8ac31), with the stacked PRs on top of their bases (#2806 → #2807 → #2808, #2806 → #2809 → #2810 and #2811 → #2812).master. Between the branches, conflicts are limited to adjacent additions (README/index rows, usage sections, imports, visitor and feature lists, one enum line and one alias guard).spotlessApply check: 11,494 tests, 11,469 passed, 25 skipped, zero failures/errors. The grammar choice conflict check passes.master: 206) and 363 of 364 PostgreSQL statements (master: 328). Every MySQL 8.4 non-reserved word and PostgreSQL 18 unreserved or column-name keyword parses as a column and table name.