Visitar URL original
Add IDENTITY() and SCOPE_IDENTITY() to LEGACY mode by katzyn · Pull Request #3381 · h2database/h2database · GitHub
Skip to content

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

Merged
katzyn merged 2 commits into
h2database:masterfrom
katzyn:legacy
Jan 17, 2022
Merged

katzyn merged 2 commits into
h2database:masterfrom
katzyn:legacy

Conversation

@katzyn

@katzyn katzyn commented Jan 17, 2022

Copy link
Copy Markdown
Contributor

For EclipseLink.

@gloyEY

gloyEY commented Mar 3, 2022

Copy link
Copy Markdown

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

@katzyn

katzyn commented Mar 4, 2022

Copy link
Copy Markdown
Contributor Author

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.

2 participants