insert using params to varchar column of > 32k colsize fails

Bug #1455670 reported by Aruna Sadashiva
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Trafodion
In Progress
Critical
Arvind Narain

Bug Description

Using bound params, insert into varchar column of colsize >32k fails with string overflow error.

To reproduce using Trafci :

SQL>CREATE TABLE TAB3 ( A INT, B VARCHAR(40000));
--- SQL operation complete.
SQL>prepare s from insert into tab3 values(?a, ?b);
--- SQL command prepared.
SQL>set param ?a 100;
SQL>set param ?b 'aaaZZ';
SQL>execute s;
*** ERROR[8402] A string overflow occurred during the evaluation of a character expression. [2015-05-15 21:27:01]

Steps from sqlci:

>>create table a3(a int, b varchar(32000));
--- SQL operation complete.
>>prepare s1 from insert into a3 values(?a,?b);
--- SQL command prepared.
>>set param ?a 1;
>>set param ?b 'aaaZZ';
>>execute s1;
--- 1 row(s) inserted.

>>create table a4(a int, b varchar(40000));
--- SQL operation complete.
>>prepare s2 from insert into a4 values(?a,?b);
--- SQL command prepared.
>>set param ?a 1;
>>set param ?b 'bbbZZ';
>>execute s2;
*** ERROR[8402] A string overflow occurred during the evaluation of a character expression.

--- 0 row(s) inserted.

Revision history for this message
Aruna Sadashiva (aruna-sadashiva) wrote :

This fails from sqlci too.

tags: added: sql-exe
removed: client-jdbc-t4
description: updated
Changed in trafodion:
assignee: nobody → Sandhya Sundaresan (sandhya-sundaresan)
Revision history for this message
Anoop Sharma (anoop-sharma) wrote :

When setting up input param values that are varchar (length followed by data), code
needs to set the length based on the returned length of param after describe.
In this case, the returned param len was 40000 but the length bytes of the varchar
was being set as a 2 byte prefix. But cli was expecting first 4 bytes as the length
prefix and that returned incorrect length which caused the overflow.

This change need to be done in both sqlci frontend as well as connectivity frontend.

I have made the change in sqlci.
Someone from conn need to make this change as well.

Changed in trafodion:
assignee: Sandhya Sundaresan (sandhya-sundaresan) → Anoop Sharma (anoop-sharma)
tags: added: client-jdbc-t4
removed: sql-exe
Changed in trafodion:
assignee: Anoop Sharma (anoop-sharma) → Arvind Narain (arvind-narain)
importance: High → Critical
Revision history for this message
Anuradha (anuradha-hegde) wrote :
Changed in trafodion:
status: New → In Progress
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.