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

Add IDENTITY() and SCOPE_IDENTITY() to LEGACY mode #3381

Merged
merged 2 commits into from Jan 17, 2022
Merged

Conversation

katzyn
Copy link
Contributor

@katzyn katzyn commented Jan 17, 2022

For EclipseLink.

@katzyn katzyn merged commit 86d58c4 into h2database:master Jan 17, 2022
1 of 3 checks passed
@katzyn katzyn deleted the legacy branch Jan 18, 2022
@gloyEY
Copy link

@gloyEY gloyEY commented Mar 3, 2022

What do you mean? How do I have to create a table with an IDENTITY KEY?

@katzyn
Copy link
Contributor Author

@katzyn katzyn commented Mar 4, 2022

These defective by design functions incorrectly used by EclipseLink aren't related with column definitions in any way.

How do I have to create a table with an IDENTITY KEY?

There is no such thing as identity key in SQL (at least in the Standard and in H2), but there are identity columns and primary key columns. An identity column can (and usually should) have a primary key constraint and it can be defined with standard-compliant

CREATE TABLE TEST(
    ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY
);

https://h2database.com/html/grammar.html#column_definition

or with some legacy vendor-specific syntax (see documentation of compatibility modes).

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.

None yet

2 participants