Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert Primary Key after import CSV Data does not work #3321

Closed
Dirzei opened this issue Jan 3, 2022 · 1 comment · Fixed by #3330
Closed

Insert Primary Key after import CSV Data does not work #3321

Dirzei opened this issue Jan 3, 2022 · 1 comment · Fixed by #3330

Comments

@Dirzei
Copy link

Dirzei commented Jan 3, 2022

Hi,
I want to add a new column to a database (import from csv file using csvread).

With H2 Version 1.4.200 the following was working:
ALTER TABLE TEST_TABLE ADD COLUMN ID BIGINT NOT NULL AUTO_INCREMENT FIRST

I tried this with the latest version 2.0.204. But it is not working.
The error message I get is:
NULL not allowed fo column "ID"; SWL statement:
INSERT INTO "PUBLIC"."TEST_TABLE_COPY_3_0" SELECT NULL, "ROW_NUM", "COLUMN_NUM", "ROW_VALUES" FROM "PUBLIC"."TEST_TABLE" [23502-204]

I did also try:
ALTER TABLE TEST_TABLE ADD COLUMN ID BIGINT GENERATED BY DEFAULT AS IDENTITY FIRST

But it is also not working...

Is this a bug, or do I something wrong here?

Thank you - cheers

@katzyn
Copy link
Contributor

katzyn commented Jan 3, 2022

Yes, it is a bug.

You can use

ALTER TABLE TEST_TABLE ADD COLUMN ID BIGINT GENERATED BY DEFAULT AS IDENTITY DEFAULT ON NULL NOT NULL FIRST;

as a temporary workarond.

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 a pull request may close this issue.

2 participants