Repository navigation
Conversation
CREATE USER and DEFINER read user@host with their own copies of the same rule. Neither accepted app@'%' or 'app'@localhost, because the lexer reads app@ and @localhost as single tokens. Without a dialect a double-quoted part also lost its quotes, so CREATE USER "app"@"%" rendered as app@%. Add one MySqlAccountName() production that splits those tokens, keep the quote character of double-quoted and backquoted parts apart from their value, and use it for CREATE USER and DEFINER. Signed-off-by: minleejae <mmj9808@gmail.com>
…E statements MySQL tools read table and column definitions and comments with SHOW FULL COLUMNS, SHOW TABLE STATUS and SHOW CREATE. Only plain SHOW COLUMNS FROM t was typed; the other forms became UnsupportedStatement, and LIKE, WHERE or a qualified table after SHOW COLUMNS failed to parse. Extend ShowColumnsStatement with EXTENDED, FULL, the FIELDS spelling, FROM/IN, a Table name, the trailing database and LIKE/WHERE, keeping getTableName() and setTableName(String). Add ShowTableStatusStatement and ShowCreateStatement for TABLE, VIEW, PROCEDURE, FUNCTION, TRIGGER, EVENT, DATABASE/SCHEMA [IF NOT EXISTS] and USER, whose account reuses MySqlAccountNamePart and accepts CURRENT_USER[()]. A typed SHOW form is chosen only when it covers the whole statement, so other dialects' SHOW variants still fall back to UnsupportedStatement. Wire the statements into the deparser, table finder, validation (showTableStatus, showCreate) and feature analysis. 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.
Builds on #2806, which shares MySQL account name parsing (
MySqlAccountName());SHOW CREATE USERuses that rule.Purpose
Parse the MySQL statements that tools use to read table and column comments and object definitions. MySQL 8.4 accepts all of them, but only the plain
SHOW COLUMNS FROM tis typed today:SHOW FULL COLUMNS FROM t,SHOW FULL FIELDS FROM t,SHOW COLUMNS IN tbecomeUnsupportedStatement.SHOW COLUMNS FROM t FROM db,SHOW COLUMNS FROM t LIKE 'p',... WHERE exprandSHOW COLUMNS FROM db.tfail to parse.SHOW TABLE STATUS [{FROM | IN} db] [LIKE 'p' | WHERE expr]becomesUnsupportedStatement.SHOW CREATE {TABLE | VIEW | PROCEDURE | FUNCTION | TRIGGER | EVENT} name,SHOW CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] dbandSHOW CREATE USER accountbecomeUnsupportedStatement.Current design (As-is)
Show()commits toShowColumns()after two tokens (COLUMNS FROM).ShowColumns()reads oneRelObjectName(), so any further clause is a parse error.ShowColumnsStatementholds only aString tableName. Its deparser always writesSHOW COLUMNS FROM.SHOWform is captured as raw tokens:ShowStatementfor one token, otherwiseUnsupportedStatement.TablesNamesFinderthrowsUnsupportedOperationExceptionforShowColumnsStatement.Target design (To-be)
ShowColumnsStatement(extended, compatible):isExtended(),isFull(),isFieldsKeyword().getTableSelectionMode()andgetDbSelectionMode()record theFROM/INspelling, reusingShowTablesStatement.SelectionMode.getTable()is aTable;getDbName(),getLikeExpression()andgetWhereCondition()hold the optional clauses.getTableName(),setTableName(String),withTableNameand both constructors remain, derived from theTable.ShowTableStatusStatement(new,statement.show):getSelectionMode(),getDbName(),getLikeExpression()andgetWhereCondition(), likeShowTablesStatement.ShowCreateStatement(new,statement.show):getObjectType():TABLE,VIEW,PROCEDURE,FUNCTION,TRIGGER,EVENT,DATABASEorUSER.getName(), a qualifiedTable, as the other routine, trigger and event statements do.DATABASEusesgetDatabaseName(),isSchemaKeyword()andisIfNotExists().USERusesgetAccount(), aUserAccountread with the sharedMySqlAccountName()of Share MySQL account names across CREATE USER and DEFINER #2806, so every account spelling of CREATE USER works (app@'%','app'@localhost,`app`@`%`,"app"@"%");isCurrentUser()andisCurrentUserParentheses()coverCURRENT_USERandCURRENT_USER().Show()chooses a typed form only when it spans the whole statement, up to;, the input end,ELSE/END, or the next statement (the new lookahead-onlyShowStatementEnd()).SHOWvariants therefore still becomeUnsupportedStatement, for example SnowflakeSHOW COLUMNS IN SCHEMA sand ClickHouseSHOW CREATE TABLE t FORMAT f.SHOW INDEX,SHOW TABLESand single-wordSHOW xare unchanged.STATUSis matched withContextualKeyword; no new tokens or reserved words. No grammar choice conflicts.StatementDeParser;ShowColumnsStatementDeParserrenders the full statement.StatementVisitordefault methods andStatementVisitorAdapter.TablesNamesFinder: reports the table ofSHOW COLUMNS(qualified by itsFROM dbclause) and ofSHOW CREATE TABLE/VIEW;SHOW TABLE STATUSand the otherSHOW CREATEkinds name no table.Feature.showTableStatusandFeature.showCreate, enabled in the MySQL and MariaDB capabilities. Metadata validation looks up theSHOW COLUMNStable in itsFROM dbdatabase and theSHOW CREATEtable, view, procedure or database.StatementFeatureVisitor: metadata read,RETURNS_RESULT_SET.TablesNamesFindernow returns the table ofSHOW COLUMNSinstead of throwing.show create table tis aShowCreateStatement; its SQL is unchanged.Validation
ShowColumnsStatementTest,ShowTableStatusStatementTest,ShowCreateStatementTestand three validator tests):toStringandStatementDeParser, and reparsed, without a dialect and withDialect.MYSQLandDialect.MARIADB;ShowColumnsStatementaccessors, builders;UnsupportedStatement, statement boundaries (;,IF ... ELSE);spotlessApply checkon top of Share MySQL account names across CREATE USER and DEFINER #2806: 10,472 tests, 10,447 passed, 25 skipped, zero failures/errors. The grammar choice conflict check passes.master(bdf8ac31) on the DDL/DCL survey corpora (MySQL 8.4 and PostgreSQL 18, with and without a dialect): no regressions and no status changes.Dialect.MYSQL, the 8SHOW FULL COLUMNS/FIELDS,SHOW TABLE STATUSandSHOW CREATE TABLE/PROCEDUREstatements change fromUnsupportedStatementto typed statements with identical SQL.SHOW COLUMNS FROM tandSHOW INDEX FROM tare unchanged.toString()on a second, identical server, in the same order. All 205 MySQL and 327 PostgreSQL statements give the same result (success, or the same error).pg_description) is byte-identical on both servers.SHOWstatements of the MySQL comment corpora ran as written and as rendered on the same server, and the outputs are byte-identical:SHOW FULL COLUMNS/FIELDS(withFROM dbandLIKE),SHOW COLUMNS,SHOW TABLE STATUS(withLIKEandWHERE),SHOW CREATE TABLE/PROCEDUREandSHOW INDEX.Integration validation
Applied this PR together with the other comment PRs (#2820, #2821, #2822, #2823), the DDL/DCL PRs #2806–#2819 and #2778 on
master(bdf8ac31), with the stacked PRs on top of their bases (#2814 → #2821, #2816 → #2822, #2806 → #2824 and #2811 → #2812 → #2823).master. Between the branches, conflicts are limited to adjacent additions (README/index rows, usage sections, imports, test methods, visitor and feature lists, an enum line and an alias guard).spotlessApply check: 11,877 tests, 11,852 passed, 25 skipped, zero failures/errors. The grammar choice conflict check passes.master: 206) and 363 of 364 PostgreSQL statements (master: 328), the same as Share MySQL account names across CREATE USER and DEFINER #2806–Render single spaces in ALTER visibility, FORCE and row level security actions #2819 together. There are no regressions.master: 67) and for 118 of 119 PostgreSQL statements (master: 76). The exception is aCREATE AGGREGATEsetup statement. Every table, column, index, partition, routine, event, user andCOMMENT ONcomment literal is aStringValue, exceptCOMMENT = _utf8mb4'x', which MySQL rejects.