Repository navigation
fix: read PostgreSQL function-call index elements without a dialect - #2967
Merged
manticore-projects merged 1 commit intoDec 2, 2026
Conversation
Contributor
|
Please resolve conflicts. |
Signed-off-by: minleejae <mmj9808@gmail.com>
minleejae
force-pushed
the
fix/index-function-elements-default-20261201
branch
from
December 2, 2026 07:40
f5a60b2 to
bd5d8c3
Compare
Contributor
|
Thank you! |
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 index elements may be function calls without extra parentheses, as in
CREATE INDEX ix ON t (lower(label))orEXCLUDE USING gist (lower(label) WITH =). WithDialect.POSTGRESQLthey are read as expressions. Without a dialect, a function call became a column named after the function, with its arguments as a text parameter:lowerwith(label), printed aslower (label).CAST(...),EXTRACT(...), schema-qualified functions and functions with expression arguments, such asint4range(n, n + 1), were parse errors.This change reads these elements with
Dialect.POSTGRESQLand without a dialect, never with another dialect, through the existingCastExpression,ExtractExpressionandFunctionbranches ofIndexColumnWithParams.CREATE INDEXandEXCLUDEconstraints inCREATE TABLEandALTER TABLEget the sameKeyElementexpressions as with the dialect.Without a dialect, a name followed by one integer in parentheses stays a MySQL key-part prefix length, as in
KEY k (label(10)). PostgreSQL readslabel(10)as a function call, and so doesDialect.POSTGRESQL.isMySqlKeyPartPrefixAhead()keeps the prefix reading.Compatibility: without a dialect, a function-call key element is now a
KeyElementwith an expression instead of a column name with parameters, and is printed without the inserted space (lower(label)). Statements that were parse errors now parse. MySQL, Oracle and the other dialects are unchanged. Without a dialect, the trailing parameter list still absorbs tokens after an element, as forn + 1before. This now also applies afterCAST(...)andEXTRACT(...). PostgreSQL rejects these forms, and so doesDialect.POSTGRESQL.Reference: PostgreSQL 18 CREATE INDEX ("the parentheses can be omitted if the expression has the form of a function call"), CREATE TABLE (
exclude_element).Validation
PostgreSqlDdlKeyOptionsTest: 8 statements parse without a dialect, round-trip, and give the same key element types as withDialect.POSTGRESQL. They coverlower(label)with operator class, order andNULLS LAST,coalesce,date_trunc,CAST,EXTRACT, a schema-qualified function withCOLLATE,int4range(n, n + 1), andEXCLUDEinCREATE TABLEandALTER TABLE. A prefix length stays a column without a dialect and with MySQL and Oracle, whileDialect.POSTGRESQLreads a function. MySQL keeps its reading oflower(label)and still rejectsCAST(...). The 8 statements fail on the base (2ba80d35c).label(10)is reported as a missing functionlabel(integer), not a syntax error. The two bare expressions mentioned above are syntax errors.gradle check(Spotless, Checkstyle, PMD, JaCoCo verification): 16,848 tests, 0 failures, 25 skipped.AI assistance: prepared with Claude Code.