Volatile table with IDENTITY column can’t be inserted with column list
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Trafodion |
Fix Released
|
High
|
Anoop Sharma |
Bug Description
When a table is defined with an IDENTITY column, a row can be inserted with a tuple list using DEFAULT as the IDNTITY column value, or with a column list leaving out the IDENTITY column. With a volatile table, the latter method fails now with error 4193 and 2006.
As shown in the following example, a volatile table t was defined with 3 columns c1, c2, c3. C1 was declared as an IDENTITY column. The first 2 inserts used DEFAULT in the tuple list and they worked fine. The following 2 inserts used a column list specifying c2 and c3. They both failed with error 4193 and 2006.
This is seen on the v1.1.0rc2 (v0422) build.
-------
Here is the entire script to reproduce it:
create schema mytest;
set schema mytest;
create volatile table t (
c1 largeint GENERATED ALWAYS AS IDENTITY,
c2 int,
c3 smallint);
insert into t values (DEFAULT,1,1);
insert into t values (DEFAULT,2,2);
insert into t (c2, c3) values (3,3);
insert into t (c2, c3) values (4,4);
select * from t;
drop schema mytest cascade;
-------
Here is the execution output:
>>create schema mytest;
--- SQL operation complete.
>>set schema mytest;
--- SQL operation complete.
>>
>>create volatile table t (
+>c1 largeint GENERATED ALWAYS AS IDENTITY,
+>c2 int,
+>c3 smallint);
--- SQL operation complete.
>>
>>insert into t values (DEFAULT,1,1);
--- 1 row(s) inserted.
>>insert into t values (DEFAULT,2,2);
--- 1 row(s) inserted.
>>insert into t (c2, c3) values (3,3);
*** ERROR[4193] The schema name prefix VOLATILE_SCHEMA_ is reserved and cannot be used.
*** ERROR[2006] Internal error: assertion failure (defaultValueExpr) in file ../optimizer/
*** ERROR[8822] The statement was not prepared.
>>insert into t (c2, c3) values (4,4);
*** ERROR[4193] The schema name prefix VOLATILE_SCHEMA_ is reserved and cannot be used.
*** ERROR[2006] Internal error: assertion failure (defaultValueExpr) in file ../optimizer/
*** ERROR[8822] The statement was not prepared.
>>select * from t;
C1 C2 C3
-------
--- 2 row(s) selected.
>>
>>drop schema mytest cascade;
--- SQL operation complete.
Changed in trafodion: | |
assignee: | nobody → Anoop Sharma (anoop-sharma) |
Changed in trafodion: | |
status: | New → In Progress |
Verified on the v0519 build installed on a cluster. This problem is now fixed:
>>create schema mytest;
--- SQL operation complete.
>>set schema mytest;
--- SQL operation complete.
>>
>>create volatile table t (
+>c1 largeint GENERATED ALWAYS AS IDENTITY,
+>c2 int,
+>c3 smallint);
--- SQL operation complete.
>>
>>insert into t values (DEFAULT,1,1);
--- 1 row(s) inserted.
>>insert into t values (DEFAULT,2,2);
--- 1 row(s) inserted.
>>insert into t (c2, c3) values (3,3);
--- 1 row(s) inserted.
>>insert into t (c2, c3) values (4,4);
--- 1 row(s) inserted.
>>select * from t;
C1 C2 C3 ------- ------ ----------- ------
-------
--- 4 row(s) selected.
>>
>>drop schema mytest cascade;
--- SQL operation complete.