Skip to content

Fix conversion of PK columns to identity columns#3859

Merged
katzyn merged 1 commit intoh2database:masterfrom
katzyn:identity
Aug 4, 2023
Merged

Fix conversion of PK columns to identity columns#3859
katzyn merged 1 commit intoh2database:masterfrom
katzyn:identity

Conversation

@katzyn
Copy link
Contributor

@katzyn katzyn commented Aug 4, 2023

Historic IDENTITY data type creates an implicit primary key constraint. Our implementation of ALTER TABLE name ALTER COLUMN columnName IDENTITY have a trick for this purpose, but this trick tries to create a second primary key constraint if column already has it. Unfortunately, normal columns were also affected, it wasn't possible to add identity generator to a primary key column with standard ALTER TABLE name ALTER COLUMN columnName SET GENERATED { ALWAYS | BY DEFAULT } command. This trick is enhanced to create a primary key constraint only if it doesn't exist.

(I think we should remove this undocumented crazy data type in the future, at least from the regular mode, only regular and legacy modes have it.)

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