You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "RaigorJiang (via GitHub)" <gi...@apache.org> on 2026/05/12 02:39:29 UTC
[PR] Support quoted identifiers for SHOW/REFRESH TABLE METADATA [shardingsphere]
RaigorJiang opened a new pull request, #38687:
URL: https://github.com/apache/shardingsphere/pull/38687
### Summary:
This PR introduces a dedicated distSQLIdentifier rule for DistSQL metadata commands, so SHOW TABLE METADATA and REFRESH TABLE METADATA can accept bare identifiers, backtick-quoted
identifiers, and double-quoted identifiers, while single quotes remain string literals and are no longer treated as object names.
### What changed:
- Updated the DistSQL grammar to use distSQLIdentifier for table, database, schema, and storage unit name positions.
- Switched the statement and executor flow to carry IdentifierValue where quoted name semantics must be preserved.
- Added parser IT coverage that verifies both the identifier value and its quote delimiters.
- Updated the SHOW/REFRESH TABLE METADATA documentation in English and Chinese to match the new syntax and examples.
### Impact:
- PostgreSQL uppercase and lowercase table names are handled correctly when quoted.
- MySQL uppercase and lowercase table names are handled correctly when quoted.
- The parser no longer accepts single-quoted strings as table or schema identifiers for these commands.
- The change is scoped to DistSQL metadata commands and does not affect unrelated SQL syntax.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Refine DistSQL quoted text handling for identifiers and strings [shardingsphere]
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang merged PR #38687:
URL: https://github.com/apache/shardingsphere/pull/38687
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Refine DistSQL quoted text handling for identifiers and strings [shardingsphere]
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on PR #38687:
URL: https://github.com/apache/shardingsphere/pull/38687#issuecomment-4427259062
• Merge Verdict: Mergeable
Reviewed Scope
- parser/distsql/engine/src/main/antlr4/imports/BaseRule.g4
- parser/distsql/engine/src/main/antlr4/imports/Literals.g4
- parser/distsql/engine/src/main/antlr4/imports/RDLStatement.g4
- parser/distsql/engine/src/main/antlr4/imports/RALStatement.g4
- parser/distsql/engine/src/main/antlr4/imports/RQLStatement.g4
- proxy/backend/core/.../ShowTableMetaDataExecutor.java
- proxy/backend/core/.../RefreshTableMetaDataExecutor.java
- mode/core/.../ContextManager.java
- test/it/parser parser cases, assertions, and unsupported cases
- DistSQL docs for SHOW/REFRESH TABLE METADATA and RDL storage unit statements
- Official PostgreSQL / MySQL / MariaDB documentation for identifier and string literal semantics
Not Reviewed Scope
- Other non-DistSQL parser families
- Other DistSQL commands not touched by this PR
- Live end-to-end validation against real PostgreSQL/MySQL/MariaDB instances
Need Expert Review
- No
Basis
- The root cause is fixed end to end. SHOW/REFRESH TABLE METADATA now use distSQLIdentifier for object-name positions, and the execution path preserves IdentifierValue semantics
through statement, executor, and ContextManager.
- The grammar split is consistent and low risk:
- IDENTIFIER_ keeps bare identifiers and backtick-quoted identifiers
- DOUBLE_QUOTED_TEXT is shared by identifier and string positions where the DistSQL syntax intentionally allows it
- SINGLE_QUOTED_TEXT remains the single-quoted string token
- The change does not introduce a lexer conflict. DOUBLE_QUOTED_TEXT is reused by different parser rules in different semantic positions, which is valid and intentional.
- Adjacent paths were checked:
- RDL storage unit statements still accept double-quoted string values
- SHOW DIST VARIABLE / SET DIST VARIABLE remain on their existing identifier/string semantics
- single-quoted object names are rejected as expected
- Official database documentation supports the behavior boundary:
- PostgreSQL uses double quotes for quoted identifiers and single quotes for string literals
- MySQL/MariaDB support backticks for identifiers, and double quotes for strings unless ANSI_QUOTES changes that behavior
- Parser IT, unit tests, checkstyle, and spotless all passed on the latest head.
Pre-merge Checks
- ./mvnw -pl test/it/parser -am -DskipITs -Dspotless.skip=true -Dtest=InternalDistSQLParserIT test -Dsurefire.failIfNoSpecifiedTests=false
Exit code: 0
- ./mvnw checkstyle:check -Pcheck -T1C -pl parser/distsql/engine,test/it/parser -am
Exit code: 0
- ./mvnw spotless:check -Pcheck -T1C -pl parser/distsql/engine,test/it/parser -am
Exit code: 0
- ./mvnw -pl proxy/backend/core,mode/core -am -DskipITs -Dspotless.skip=true
-Dtest=ShowTableMetaDataExecutorTest,RefreshTableMetaDataExecutorTest,DistSQLUpdateProxyBackendHandlerTest,DistSQLQueryProxyBackendHandlerTest,ContextManagerTest test
-Dsurefire.failIfNoSpecifiedTests=false
Exit code: 0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org