Repository navigation
Conversation
Signed-off-by: minleejae <mmj9808@gmail.com>
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.
MySQL key parts may index a prefix of a column, as in
KEY k (label(10)).KeyElementkept the prefix as the first entry ofgetParams(), the text(10), next toDESCand other legacy parameters, and printed it with a space (label (10)). Callers had to recognise the prefix by matching that text.KeyElementnow hasgetPrefixLength(),setPrefixLength(Integer)andwithPrefixLength(Integer).IndexColumnWithParamssets it for a column name followed by one integer in parentheses, in every dialect except PostgreSQL, which reads the same text as a function call.isMySqlKeyPartPrefixAhead(), which #2967 added to keep such a prefix from being read as a function call, now takes the position of the parenthesis and decides both cases. The prefix is no longer repeated ingetParams().KeyElementprints it right after the name, as MySQL does:label(10) DESC.Compatibility:
KeyElementwas added in #2747 and is not in a release yet. Statements parse as before, and only the representation changes:getParams()no longer contains(10), andtoString()printslabel(10)instead oflabel (10). Other parenthesized parameters, such aslower(label)with MySQL or Oracle, stay ingetParams(). The tests that pinned the old representation (CreateIndexTest,MySqlIndexSpecOptionTest,DeparseWhitespaceTest, andPostgreSqlDdlKeyOptionsTestfrom #2967) are updated.Reference: MySQL 8.4 CREATE INDEX (
key_part: {col_name [(length)] | (expr)} [ASC | DESC], "Column Prefix Key Parts").Validation
MySqlKeyPartPrefixLengthTestcoversCREATE INDEX,KEY,UNIQUE KEYandPRIMARY KEYinCREATE TABLE, andADD INDEXandADD UNIQUE KEYinALTER TABLE. Without a dialect and with MySQL and MariaDB, each prefix length is kept, the statement is printed unchanged and round-trips through the deparser. A changed or removed prefix length is printed. MySQL and Oracle keep other parentheses as parameters, and PostgreSQL readslabel(10)as a function call.gradle check(Spotless, Checkstyle, PMD, JaCoCo verification) andcheckGrammarAmbiguity: 18,715 tests, 0 failures, 25 skipped; no choice conflicts.AI assistance: prepared with Claude Code.