Forum: Building VoltDB Applications

Post: Unexpected token DEFAULT

Unexpected token DEFAULT
yiannis
Dec 18, 2011
Hello,

When using the example found in the FAQ
CREATE TABLE AUTOINCREMENT (
TABLE_NAME VARCHAR[50] NOT NULL,
CURRENT_VALUE BIGINT NOT NULL DEFAULT 1 );

the VoltDB compiler throws DDL ERROR: "unexpected token DEFAULT"

When NOT NULL is removed, the schema compiles without problems.
Error in code sample
ajgent
Dec 19, 2011
Hi,

Thanks for pointing this out. There are two problems with the code sample:


  • The argument to VARCHAR should be in parentheses not square brackets
  • The DEFAULT condition must precede the NULL/NOT NULL condition.


So the correct code should be:

CREATE TABLE AUTOINCREMENT (
TABLE_NAME VARCHAR(50) NOT NULL,
CURRENT_VALUE BIGINT DEFAULT 1 NOT NULL );


I will make this change in the FAQ.

Thanks!
--Andrew