You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "Alice Chen (JIRA)" <ji...@apache.org> on 2015/07/22 20:18:08 UTC

[jira] [Created] (TRAFODION-774) LP Bug: 1393988 - Missing UDF return values should have been caught at the create function time

Alice Chen created TRAFODION-774:
------------------------------------

             Summary: LP Bug: 1393988 - Missing UDF return values should have been caught at the create function time
                 Key: TRAFODION-774
                 URL: https://issues.apache.org/jira/browse/TRAFODION-774
             Project: Apache Trafodion
          Issue Type: Bug
          Components: sql-exe
            Reporter: Weishiun Tsai
            Assignee: Hans Zeller


Currently, if a user does not specify the required ‘returns (<values>)’ option for ‘create function’, the create statement does not catch this error.  However, error 4457 is returned when the UDF is used in a statement.  This error should have been caught earlier at the create function time.

This is seen on the v1115_0830 build installed on a workstation.

To reproduce this problem, you need to install UDF first by following the instructions bellow:

(1) Download the attached tar file and untar it to get the 4 files in there. Put the 4 files in any directory <mydir>
(2) Run build.sh from <mydir> to build the UDF so file.
(3) Change the line ‘create library myudflib file '<mydir>'; in mytest.sql and fill in <mydir>
(4) From sqlci, obey mytest.sql

------------------------------------------------------------------------------------------------------------------
Here is the execution output of mytset.sql

>>obey mytest.sql;
>>set schema MYUDFTEST;

--- SQL operation complete.
>>
>>create table mytab (a int);

--- SQL operation complete.
>>insert into mytab values (1),(2),(3);

--- 3 row(s) inserted.
>>
>>create library myudflib file '<mydir>’;

--- SQL operation complete.
>>
>>create function ENCRYPT_I
+>(INVAL INT)
+>-- returns (OUTVAL INT)
+>language c
+>parameter style sql
+>external name 'encrypt_i'
+>library myudflib
+>deterministic
+>state area size 1024
+>allow any parallelism
+>no sql;

--- SQL operation complete.
>>
>>select encrypt_i(a) from mytab;

*** ERROR[4457] An error was encountered processing metadata for user-defined function TRAFODION.MYUDFTEST.ENCRYPT_I.  Details: User-defined functions must have at least one registered output value.

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

>>
>>drop function ENCRYPT_I cascade;

--- SQL operation complete.
>>drop library myudflib cascade;

--- SQL operation complete.
>>drop schema MYUDFTEST cascade;

--- SQL operation complete.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)