Volatile table with IDENTITY column can’t be inserted with column list

Bug #1448257 reported by Weishiun Tsai
6
This bug affects 1 person
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/BindRelExpr.cpp at line 9781.

*** 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/BindRelExpr.cpp at line 9781.

*** ERROR[8822] The statement was not prepared.

>>select * from t;

C1 C2 C3
-------------------- ----------- ------

                   1 1 1
                   2 2 2

--- 2 row(s) selected.
>>
>>drop schema mytest cascade;

--- SQL operation complete.

Tags: sql-exe
Changed in trafodion:
assignee: nobody → Anoop Sharma (anoop-sharma)
Changed in trafodion:
status: New → In Progress
Revision history for this message
Weishiun Tsai (wei-shiun-tsai) wrote :

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
-------------------- ----------- ------

                   1 1 1
                   2 2 2
                   3 3 3
                   4 4 4

--- 4 row(s) selected.
>>
>>drop schema mytest cascade;

--- SQL operation complete.

Changed in trafodion:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.