Menu

#21 Negative default values not handled correctly

open
nobody
None
5
2012-12-07
2012-02-29
Anonymous
No

A CREATE statement with default values that are negative are not handled correctly. Please see the example below where the default value for MONTH is -1.

With <<QUERY>> =
CREATE TABLE dim_date(
date DATE NOT NULL,
year INTEGER NOT NULL,
quarter INTEGER NOT NULL,
month INTEGER NOT NULL DEFAULT -1,
day INTEGER NOT NULL
);

This test fails:

private CCJSqlParserManager sqlParser = new CCJSqlParserManager();
Statement stmt = sqlParser.parse(new StringReader(<<QUERY>>);
assertTrue(stmt instanceof CreateTable);

Discussion