Description
When UPDATE STATISTICS tries to create a multi-column histogram, and one or more of the columns has a name which happens to be a SQL reserved word, the command fails with a syntax error on an internal statement.
The following script reproduces the problem (here, the failure occurs when UPDATE STATS tries to create a multi-column histogram on the two key columns):
?section setup
create table ExampleTable
( a smallint not null,
"YEAR" smallint not null,
primary key (a, "YEAR") );
insert into ExampleTable values (1,1996),(2,1997),(3,1998);
?section doit
update statistics for table ExampleTable on every column;
Below is the execution output:
>>obey repro.sql;
>>?section setup
>>
>>create table ExampleTable
+>( a smallint not null,
+> "YEAR" smallint not null,
+> primary key (a, "YEAR") );
— SQL operation complete.
>>
>>insert into ExampleTable values (1,1996),(2,1997),(3,1998);
— 3 row(s) inserted.
>>
>>?section doit
>>
>>update statistics for table ExampleTable on every column;
-
-
- ERROR[9200] UPDATE STATISTICS for table TRAFODION.SCH.EXAMPLETABLE encountered an error (15001) from statement FETCH_BOUNDARY_ROWSET.
-
-
-
- ERROR[15001] A syntax error occurred at or before:
SELECT FMTVAL, SUMVAL FROM (SELECT "A","YEAR", _ucs2'unused', COUNT FROM TRA
FODION.SCH.EXAMPLETABLE <<+ cardinality 3.000000e+00 >> GROUP BY A, YEAR FOR R
EAD UNCOMMITTED ACCESS) T(A, YEAR, FMTVAL, SUMVAL);
^ (162 characters from start of SQL statement)
- ERROR[15001] A syntax error occurred at or before:
-
-
-
- ERROR[8822] The statement was not prepared.
-
— SQL operation failed with errors.
>>
>>
Attachments
Issue Links
- links to