lbehnke / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

UNIQUE property parsing problem in CREATE TABLE #71

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, 

this sql "CREATE TABLE TESTTBL (TESTCOL INT(1) UNIQUE NOT NULL)" produce
error [42001-109] 42001/42001.

When switch the "NOT NULL" with "UNIQUE" the table created succesfully.
(like this: "CREATE TABLE TESTTBL (TESTCOL INT(1) NOT NULL UNIQUE)")

Possible workaround add the not null check in the org.h2.command.Parser
parseCreateTable method, after line 4676.
-----8<-------
if (readIf("NOT")) {
    read("NULL");
    column.setNullable(false);
} else {
    readIf("NULL");
}
----->8-------

Original issue reported on code.google.com by ferenc.b...@gmail.com on 25 Mar 2009 at 2:07

GoogleCodeExporter commented 9 years ago
The workaround in patch file

Original comment by ferenc.b...@gmail.com on 25 Mar 2009 at 10:52

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for your help! The syntax you used is supported by MySQL, so I will also
support it starting with the next release.

Original comment by thomas.t...@gmail.com on 25 Mar 2009 at 8:43

GoogleCodeExporter commented 9 years ago
This create table (genenrated by eclipselink 1.1) works good in mysql, 
postgresql and
oracle xe (10g) too.
I attchached the example project.

Original comment by ferenc.b...@gmail.com on 25 Mar 2009 at 11:22

Attachments:

GoogleCodeExporter commented 9 years ago
This should be fixed with todays release (1.1.110).
Please tell me if not, I will then re-open this bug.

Original comment by thomas.t...@gmail.com on 3 Apr 2009 at 3:59

GoogleCodeExporter commented 9 years ago
Tested, works good.
Thanks.

Original comment by ferenc.b...@gmail.com on 7 Apr 2009 at 10:18