Hi,

I have found out the following issue with unnamed constraints.

CREATE TABLE TEST (
    COL INT CHECK(COL < 500)
);

INSERT INTO TEST VALUES(10);

All is fine up to this point.
Even though in SQL grammar this "inline" syntax is not documented this works just fine.
Database can be booted and all is well.

But if I do the following

COMMENT ON COLUMN TEST.COL IS 'Whatever';

And then reboot the database the database will not work because it tries to create itself with the following statement that does not work.

CREATE TABLE TEST (
    COL INT CHECK(COL < 500) COMMENT 'Whatever'
);

Now the database is corrupted.

I think there are 3 alternatives to fix this:

1) Unnamed constraints must be forbidden altogether
2) Unnamed constraints must be given system generated name so that they are refactored away from column definitions
CREATE TABLE TEST (
    COL INT,
    CONSTRAINT SYS_GEN_NAME CHECK(COL < 500) COMMENT 'Whatever'
);

- Rami

--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to