Is it just me, or is the SQL syntax for primary keys broken? Well, I 
know it's not just me - it's at least HypersonicSQL as well.

Running the testbean test gives failures creating the tables. One of the 
offending SQL strings is (formatting added by me):

CREATE TABLE nextgen_EnterpriseEntity (
   name VARCHAR(256) CONSTRAINT pknextgen_EnterpriseEntity PRIMARY KEY,
   otherField INTEGER
)

I'm no SQL expert (well, I've written a parser for SELECT statements, 
but I haven't implemented CREATE TABLE yet :-), but shouldn't this be:

CREATE TABLE nextgen_EnterpriseEntity (
   name VARCHAR(256),
   otherField INTEGER,
   CONSTRAINT pknextgen_EnterpriseEntity PRIMARY KEY
)

or perhaps

CREATE TABLE nextgen_EnterpriseEntity (
   name VARCHAR(256) PRIMARY KEY,
   otherField INTEGER
)

?

At least, that's the syntax that HSQL understands.

InstantDB doesn't seem to recognise CONSTRAINT at all, but it would work 
with the latter syntax.

The syntax that's currently used appears to be correct for PostgreSQL. 
The latter should also work for that.

I propose remove the "CONSTRAINT pkfoo" bit. Any objections?

Regards,

Toby.


Reply via email to