TMUDF: CLOB and BLOB in TMUDF crash sqlci with a core
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Trafodion |
Fix Released
|
High
|
Hans Zeller |
Bug Description
TMUDF currently can’t handle CLOB and BLOB data types. It crashes sqlci in ExUdrTcb:
This is seen on the v0305 build installed on a workstation. To reproduce it:
(1) Download the attached tar file and untar it to get the 3 files in there. Put the files in any directory <mydir>
(2) Make sure that you have run ./sqenv.sh of your Trafodion instance first as building UDF needs $MY_SQROOT for the header files.
(3) Run build.sh from <mydir> to build the UDF so file.
(4) Change the line create library qaTmudfLib file '<mydir>
(5) From sqlci, obey mytest.sql
-------
Here is the execution output:
>>log mytest.log clear;
>>drop schema mytest cascade;
*** ERROR[1003] Schema TRAFODION.MYTEST does not exist.
--- SQL operation failed with errors.
>>create schema mytest;
--- SQL operation complete.
>>set schema mytest;
--- SQL operation complete.
>>
>>create library qaTmudfLib file '<mydir>
--- SQL operation complete.
>>
>>create table_mapping function qa_tmudf()
+>external name 'QA_TMUDF'
+>language cpp
+>library qaTmudfLib;
--- SQL operation complete.
>>
>>create table mytable (c_clob clob, c_blob blob);
--- SQL operation complete.
>>showddl mytable;
CREATE TABLE TRAFODION.
(
C_CLOB VARCHAR(100000) CHARACTER SET ISO88591
COLLATE DEFAULT DEFAULT NULL
, C_BLOB VARCHAR(100000) CHARACTER SET ISO88591
COLLATE DEFAULT DEFAULT NULL
)
;
--- SQL operation complete.
>>insert into mytable values ('CLOB_1', 'BLOB_1');
--- 1 row(s) inserted.
>>select CAST(c_clob as CHAR(10)), CAST(c_blob as CHAR(10)) from mytable;
(EXPR) (EXPR)
---------- ----------
CLOB_1 BLOB_1
--- 1 row(s) selected.
>>select CAST(c_clob as CHAR(10)), CAST(c_blob as CHAR(10)) from UDF(qa_
Aborted (core dumped)
-------
Here is the stack trace of the core file:
(gdb) bt
#0 0x00000039e28328a5 in raise () from /lib64/libc.so.6
#1 0x00000039e283400d in abort () from /lib64/libc.so.6
#2 0x00007ffff5d14810 in assert_botch_abend (
f=0x7ffff4d
m=0x7ffff4d
c=<value optimized out>) at ../export/
#3 0x00007ffff4c9be67 in ExUdrTcb:
this=<value optimized out>) at ../executor/
#4 0x00007ffff4c9bfc8 in ExUdrTcb::tmudfWork (this=0x7fffe97
at ../executor/
#5 0x00007ffff4c63e83 in ExScheduler::work (this=0x7fffe97
prevWaitTim
#6 0x00007ffff4b8d9c6 in ex_root_tcb::fetch (this=0x7fffe97
cliGlobals=
0x7fffe9760d40, diagsArea=
closeCursor
#7 0x00007ffff5fb2598 in CliStatement::fetch (this=0x7fffe97
cliGlobals=
newOperation=1) at ../cli/
#8 0x00007ffff5f5a21f in SQLCLI_
statement_
num_
input_
#9 0x00007ffff5f5ac3d in SQLCLI_
cliGlobals=
output_
num_
ptr_
#10 0x00007ffff5fbe57b in SQL_EXEC_Fetch (statement_
output_
#11 0x00007ffff79c9362 in SqlCmd::doFetch (sqlci_
stmt=<value optimized out>, prep_stmt=<value optimized out>,
firstFetch=
at ../sqlci/
#12 0x00007ffff79cd574 in SqlCmd::do_execute (sqlci_
prep_
unnamedPara
at ../sqlci/
#13 0x00007ffff79ce46d in DML::process (this=0x29b57f0, sqlci_env=0xb819c0)
at ../sqlci/
#14 0x00007ffff79b4a84 in Obey::process (this=0x23de4e0,
sqlci_
#15 0x00007ffff79bcf14 in SqlciEnv::run (this=0xb819c0,
in_
at ../sqlci/
#16 0x00000000004019c2 in main (argc=3, argv=0x7fffffff
at ../bin/
Changed in trafodion: | |
assignee: | nobody → Hans Zeller (hans-zeller) |
With the fix, we will issue the following error:
*** ERROR[11151] Unable to use 'type' 'LOB ALLOWS NULLS' in a user-defined routine. Details: unsupported type class.
If we convert LOBs to VARCHAR, which is currently the default, the UDF should be able to handle those data types.