15

I have having trouble getting HSQLDB to create a table with a boolean column. It seems every time I try to specify a default, I get the exception:

org.hsqldb.HsqlException: unexpected token: DEFAULT

I can create this problem even with this trivial table definition:

CREATE TABLE foo (
  bar BOOLEAN NOT NULL DEFAULT FALSE
);

According to the documentation, I should be able to do this!

See columnDefinition in http://www.hsqldb.org/doc/guide/ch09.html#create_table-section

Have I misunderstood something here?

NickJ
  • 9,380
  • 9
  • 51
  • 74

1 Answers1

30

From the HSQLDB doc provided, the correct syntax is

CREATE TABLE foo (
  bar BOOLEAN DEFAULT FALSE NOT NULL
);

i.e. The order matters in the SQL

Reimeus
  • 158,255
  • 15
  • 216
  • 276