dynamobi/dynamobi — Issue #587: [FRG-285] Second statement to use default column value gets AssertionError
Author: dynamobi-build
Created: 2011-12-30 03:37:08+00:00
State: open
Labels: FRG, SQL Validator

[reporter="jhyde", created="Wed, 18 Jul 2007 11:52:10 -0500 (GMT-05:00)"]
If you create a table where one of the columns has a default value, and you insert into that table, the statement works fine. But if you execute a similar statement, get an assertion error.

Testcase:

> set schema 'sales';

> create table t (i integer primary key not null, j varchar(10) default 'foo');

No rows affected (1.161 seconds)

> insert into t (i) values (1);

1 row affected (1.136 seconds)

> insert into t (i) values (2);

Error: java.lang.AssertionError: type mismatch:

type1:

CHAR(3) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" NOT NULL

type2:

CHAR(3) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" NOT NULL

(state=,code=0)

Note that the type is CHAR(3), the same as the default value. I'm guessing that the type of the default value is cached from the previous execution, but belongs to a different type-factory so does not compare equal.