fix(kingbase): use double-quote for DROP COLUMN identifier - #2145
Conversation
KingBase is PostgreSQL-derived and uses double-quote identifiers everywhere, but DROP COLUMN used MySQL-style backticks, producing invalid SQL. Use double quotes, mirroring PostgreSQL. Fixes OtterMind#2142 Co-Authored-By: Claude <noreply@anthropic.com>
5cdc4f6 to
23773e1
Compare
openai0229
left a comment
There was a problem hiding this comment.
Reviewed against the current main branch. The Kingbase DROP COLUMN quoting change is focused and correct, the relevant modules compile and tests pass, and I found no remaining code blocker. Thank you for the contribution.
Live-database verification (PostgreSQL 16)Tested the same bug class (unquoted DROP COLUMN on mixed-case identifiers) against a live PostgreSQL 16 container: Fix (quoted): Old behavior (unquoted): PostgreSQL lowercases unquoted identifiers, so mixed-case column names can only be dropped with double-quote quoting. KingBase (PG-derived) has the same behavior. |
Replaces direct backtick concatenation with KingBaseMetaData.KINGBASE_SQL_IDENTIFIER_PROCESSOR.quoteIdentifierAlways, per the maintainer review on OtterMind#2187. Built on the SPI extension (OtterMind#2234). Closes OtterMind#2145 (superseded by this SPI-based approach) Co-Authored-By: Claude <noreply@anthropic.com>
Related issue
Closes #2142
Summary
KingBase is PostgreSQL-derived and quotes identifiers with double quotes everywhere else (
KingBaseMetaData,SQL_ALTER_COLUMN,buildCreateColumnSql). But the DROP-column path used MySQL-style backticks:SQL_DROP_COLUMN = "DROP COLUMN ``"andcolumn.getName() + "``", producingDROP COLUMN ``name``` which is invalid KingBase SQL. Changed both to double-quote quoting, mirroring the PostgreSQL sibling (PostgreSQLColumnTypeEnumConstants`).Affected surfaces
Verification
mvn -B -q -f chat2db-community-server/pom.xml -pl chat2db-community-plugins/chat2db-community-kingbase -am -Dmaven.test.skip=true compile-> BUILD SUCCESS.DROP COLUMN "name"(double-quoted), valid KingBase SQL.Risk and compatibility
Reviewer map
KingBaseColumnTypeEnumConstants.java:20—DROP COLUMN `` ->DROP COLUMN ";KingBaseColumnTypeEnum.java:142—column.getName() + "``"->column.getName() + """`.Contributor declaration
AI assistance: The fix, verification, and PR description were produced with Claude Code assistance.