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
CREATE TABLE succeeds or fails depending on the order of the CONSTRAINT statements #3961
Comments
I tried both in 2.2.224 and first one is failing, but second works.
It makes much more sense to me, because foreign key constraint assume existence of a unique key. |
It is possible that I switched them around by accident. The problem does not occur on other database platforms we are using. |
I think there is a bug in H2, but inline referential constraints in table definitions are always problematic even when there are no bugs in the database system itself. At least some frameworks always create them only after creation of all tables to avoid all kinds of issues here (such as execution of table creation scripts in a wrong order and others). |
For H2 versions 2.1.210 the following query works:
where the next query fails:
The only difference being the order of the two last CONSTRAINTS.
For H2 versions 1.4.196 both queries succeed.
Is there a reason why second query has stopped working?
The text was updated successfully, but these errors were encountered: