fix(db2): skip column comment for dropped columns in ALTER#2083
Merged
Conversation
buildAlterTable appended COMMENT ON COLUMN whenever the comment was non-blank, including for a DROP-status column whose DROP COLUMN was emitted just before, producing invalid SQL. Guard with !EditStatusEnum.DELETE, mirroring Oracle/DM. Fixes OtterMind#2078 Co-Authored-By: Claude <noreply@anthropic.com>
openai0229
approved these changes
Jul 25, 2026
openai0229
left a comment
Contributor
There was a problem hiding this comment.
Reviewed the final DB2 DROP COLUMN fix at fbf69e0. The change only suppresses COMMENT ON COLUMN for DELETE-status columns, matching the existing Oracle/DM behavior; the previous head passed backend checks and Java CodeQL, and the final synchronized head is running the required validation.
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.
Related issue
Closes #2078
Summary
DB2SqlBuilder.buildAlterTableappended aCOMMENT ON COLUMNwhenever the column's comment was non-blank, including for aDELETE-status column. For such a column,buildModifyColumnemitsALTER TABLE ... DROP COLUMN "c", then the code appendedCOMMENT ON COLUMN "schema"."table"."c" IS '...'for the just-dropped column, producing invalid SQL. Added the&& !EditStatusEnum.DELETE.name().equals(tableColumn.getEditStatus())guard (and theEditStatusEnumimport), mirroring Oracle (OracleSqlBuilder.java:184-185) and DM.Affected surfaces
Verification
mvn -B -q -f chat2db-community-server/pom.xml -pl chat2db-community-plugins/chat2db-community-db2 -am -Dmaven.test.skip=true compile-> BUILD SUCCESS.Risk and compatibility
Reviewer map
DB2SqlBuilder.buildAlterTable— comment condition nowStringUtils.isNotBlank(tableColumn.getComment()) && !EditStatusEnum.DELETE.name().equals(tableColumn.getEditStatus()); newEditStatusEnumimport.Contributor declaration
AI assistance: The fix, verification, and PR description were produced with Claude Code assistance.