fix(postgresql,kingbase): use SPI quoteIdentifierAlways for foreign schema and table in REFERENCES - #2265
Closed
Aias00 wants to merge 2 commits into
Closed
fix(postgresql,kingbase): use SPI quoteIdentifierAlways for foreign schema and table in REFERENCES#2265Aias00 wants to merge 2 commits into
Aias00 wants to merge 2 commits into
Conversation
Aias00
force-pushed
the
rework/pg-kingbase-fk-via-spi
branch
from
July 27, 2026 13:12
9f470bf to
e9df588
Compare
Contributor
Author
|
Fixed the import — the processor classes needed correct package-qualified imports. Now compiles cleanly: |
4 tasks
Add a new SPI method that unconditionally quotes an identifier, preserving the exact name regardless of case or keyword status. Embedded delimiter characters are escaped per the dialect convention (double-quote "" for ", backtick `` for `, bracket ]] for ]). Fix removeIdentifierQuote to unescape doubled delimiters, satisfying the round-trip contract: removeIdentifierQuote(quoteIdentifierAlways(raw)).equals(raw). Implementations: - DefaultSQLIdentifierProcessor: double-quote + escape " -> "" - MysqlIdentifierProcessor: backtick + escape ` -> `` - SqlServerIdentifierProcessor: bracket + escape ] -> ]] Also add SNOWFLAKE_SQL_IDENTIFIER_PROCESSOR static field to SnowflakeMetaData, mirroring PostgreSQL/KingBase, to give Snowflake column-type enums access to the processor for downstream quoting PRs. Tests: 36 tests covering conditional vs always-quote, embedded delimiters, round-trip, reserved keywords, and case preservation across Default, MySQL, and SqlServer processors. Addresses the maintainer review on OtterMind#2187 requesting the shared SPI contract be extended before rebasing the individual dialect quoting PRs. Co-Authored-By: Claude <noreply@anthropic.com>
…chema and table in REFERENCES Replaces direct " concatenation with the dialect-specific processor: PostgreSQLMetaData.POSTGRE_SQL_IDENTIFIER_PROCESSOR and KingBaseMetaData.KINGBASE_SQL_IDENTIFIER_PROCESSOR. Built on the SPI extension (OtterMind#2234). Closes OtterMind#2187 (superseded by this SPI-based approach) Co-Authored-By: Claude <noreply@anthropic.com>
Aias00
force-pushed
the
rework/pg-kingbase-fk-via-spi
branch
from
July 27, 2026 16:09
e9df588 to
cc660cb
Compare
3 tasks
openai0229
requested changes
Jul 28, 2026
openai0229
left a comment
Contributor
There was a problem hiding this comment.
This remains blocked on PR 2234 and only routes the foreign schema and table through the processor. Foreign column names are still directly wrapped with double quotes, despite the review requiring each qualified identifier component to be processed separately. After 2234 is resolved, rebase and add exact generated REFERENCES DDL tests for schema, table, and every column, including omitted schema, mixed case, reserved words, and embedded double quotes.
Aias00
force-pushed
the
rework/pg-kingbase-fk-via-spi
branch
from
July 28, 2026 14:24
c47063d to
cc660cb
Compare
Contributor
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.
Summary
Replaces the direct
"concatenation in the old PR #2187 withprocessor.quoteIdentifierAlways(), per the maintainer's architectural review. Built on the SPI extension #2234.The
buildForeignColummethod in bothPostgreSQLIndexTypeEnumandKingBaseIndexTypeEnumconcatenatedgetForeignSchemaName()andgetForeignTableName()raw into theREFERENCESclause, while the foreign columns below were already double-quoted. Now all components go through the processor:Verification
mvn compile-> BUILD SUCCESS (on the SPI extension branch)Contributor declaration
AI assistance: The fix, verification, and PR description were produced with Claude Code assistance.