Skip to content

HCK-18624: Do not generate SET DEFAULT when the default value is unchanged - #101

Closed
Sylvie-P wants to merge 1 commit into
developfrom
HCK-18624
Closed

Sylvie-P wants to merge 1 commit into
developfrom
HCK-18624

Conversation

@Sylvie-P

@Sylvie-P Sylvie-P commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor
Sub-bugHCK-18624 [PostgreSQL] FE generates a redundant ALTER COLUMN SET DEFAULT for a false default when the column has a comment

## Problem

Same as hackolade/PostgreSQL#210. Column comments always go in separate statements in this plugin, so every column with a comment goes through the ALTER script helpers. In defaultValueHelper.js, the filter newDefault !== undefined && (!oldDefault || newDefault !== oldDefault) treats a falsy old default (false, 0, "") as missing, so an unchanged default is generated again as ALTER COLUMN ... SET DEFAULT, next to the inline default of CREATE TABLE.

Change

newDefault !== undefined && newDefault !== oldDefault

Checked (helper called directly with node)

Old default New default Before After
false false SET DEFAULT false nothing
0 0 SET DEFAULT 0 nothing
absent false (separate option) SET DEFAULT false SET DEFAULT false
false true SET DEFAULT true SET DEFAULT true
false absent DROP DEFAULT DROP DEFAULT

Regression test in Studio, same branch name HCK-18624 (hackolade/studio#6787).

🤖 Generated with Claude Code

…anged

The filter treated a falsy old default (false, 0, empty string) as missing,
so an unchanged default was generated again as ALTER COLUMN SET DEFAULT.
This happens in forward-engineering for any column with a comment, because
column comments go through the ALTER script path. Same fix as PostgreSQL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@Sylvie-P

Copy link
Copy Markdown
Contributor Author

Superseded by #102 (own sub-task HCK-18634, so it does not merge with the PostgreSQL fix of HCK-18624).

@Sylvie-P Sylvie-P closed this Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant