Repository navigation
Conversation
Signed-off-by: minleejae <mmj9808@gmail.com>
Contributor
|
Please fix grammar ambiguities. |
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.
PostgreSQL's
ALTER TABLEactions such asOWNER TO,SET (...),RESET (...),REPLICA IDENTITY,SET TABLESPACE,SET LOGGED | UNLOGGED,CLUSTER ON,[NO] INHERITandENABLE | DISABLE TRIGGERwere structured only withDialect.POSTGRESQL. Without a dialect they fell to the generic fallback, which keeps the action and every action after it as oneUNSPECIFICtext.ALTER TABLE t OWNER TO bob, ADD COLUMN c inttherefore gave noADDexpression, so callers that parse DDL from several databases without choosing a dialect lost the actions that followed.ALTER CONSTRAINT c [NO] INHERITandALTER COLUMN c {SET | RESET} (...)were parse errors without a dialect.VALIDATE CONSTRAINTandENABLE | DISABLE RULEare already read in every dialect.This change reads these actions with
Dialect.POSTGRESQLand without a dialect, never with another dialect. They go through the existingPostgreSqlRelationActionproduction, so the result is the sameRelationAlterActionas withDialect.POSTGRESQL:OWNER TO,SET (...),RESET (...),REPLICA IDENTITY,SET SCHEMA,SET TABLESPACE,SET ACCESS METHOD,SET WITHOUT CLUSTER | OIDS,SET LOGGED | UNLOGGED,CLUSTER ON,OF,NOT OF,INHERIT,NO INHERIT,ENABLE | DISABLE [ALWAYS | REPLICA] TRIGGERALTER CONSTRAINT name [NO] INHERIT,ALTER [COLUMN] c SET (...),ALTER [COLUMN] c RESET (...)Without a dialect, three readings stay as they were:
ALTER COLUMN c SET STATISTICS | STORAGE | COMPRESSIONandALTER COLUMN c DROP EXPRESSIONstay with the genericALTER COLUMNbranch (AlterOperation.ALTER), which already reads them.CLUSTER BY (...)is not taken asCLUSTER ON.ENABLE | DISABLE TRIGGER t1, t2is not split into a PostgreSQL action and an unspecified remainder.The decision lives in
isPostgreSqlRelationActionAhead(), with a smallisTriggerNameListAhead()lookahead for the SQL Server list.Compatibility: without a dialect, statements that gave one
UNSPECIFICexpression now give aRelationAlterActionfollowed by the expressions of the actions after it;toString()differs only in whitespace. The four column and constraint forms above change from parse errors to parsed statements, and PostgreSQL accepts all of them.Dialect.POSTGRESQLis unchanged, and MySQL, SQL Server and the other dialects keep the generic reading.Reference: PostgreSQL 18 ALTER TABLE ("All the forms of ALTER TABLE that act on a single table, except RENAME, SET SCHEMA, ATTACH PARTITION, and DETACH PARTITION can be combined into a list of multiple alterations to apply together.")
Validation
PostgreSqlRelationAlterTest:, ADD COLUMN z INT, parse without a dialect into the sameRelationAlterActionkind and text as withDialect.POSTGRESQL, keep theADDexpression and round-trip.SET SCHEMAis structured without a dialect when it is the only action.ba9291f1f); the cases below pass on both.OWNER TOkeeps the generic reading withDialect.MYSQLandDialect.SQLSERVER;CLUSTER BY (a)and SQL Server trigger lists keep it without a dialect;ALTER COLUMN ... SET STATISTICS | STORAGE | COMPRESSIONandDROP EXPRESSIONkeepAlterOperation.ALTER.ADD COLUMN; the only errors were about missing objects (type, trigger, parent table) or the constraint type.SET SCHEMAgives a syntax error in a list, as documented, so it is tested alone. The parser still accepts it in a list, as it already did withDialect.POSTGRESQLand, as oneUNSPECIFICtext, without a dialect.gradle check(Spotless, Checkstyle, PMD, JaCoCo verification): 16,795 tests, 0 failures, 25 skipped.AI assistance: prepared with Claude Code.