Order of VARIADIC parameters is not preserved
---------------------------------------------
Key: TEIID-3795
URL:
https://issues.jboss.org/browse/TEIID-3795
Project: Teiid
Issue Type: Bug
Reporter: Salvatore R
Assignee: Steven Hawkins
Fix For: 8.12.2, 8.13
It seems that the order of VARIADIC arguments passed to a stored procedure is not always
preserved.
For example, I defined a procedure in a virtual model in the VDB as follows:
{code:sql}
<model visible = "true" type = "VIRTUAL" name =
"test_variadic">
<metadata type = "DDL"><![CDATA[
CREATE PROCEDURE p1(VARIADIC parameters string)
AS BEGIN
declare integer i = 1;
WHILE(i <= array_length(parameters))
BEGIN
exec "SYSADMIN.logMsg"("level" => 'INFO',
"context" => 'test', "msg" => 'param '||
parameters[i]);
i = i + 1;
END
END;
]]>
</metadata>
</model>
{code}
The procedure just prints to the console the passed arguments.
When I call the procedure:
{code:sql}
exec "test_variadic.p1"('1' , '2', '3' , '4',
'5' , '6', '7' , '8', '9' , '10',
'11' , '12', '13' , '14', '15' , '16',
'17' , '18', '19' , '20')
{code}
only the first 15 parameters are printed in the same order as they are passed, as shown
in the log below:
{code}
22:44:26,117 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 1
22:44:26,118 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 2
22:44:26,119 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 3
22:44:26,122 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 4
22:44:26,123 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 5
22:44:26,125 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 6
22:44:26,127 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 7
22:44:26,130 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 8
22:44:26,132 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 9
22:44:26,134 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 10
22:44:26,138 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 11
22:44:26,138 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 12
22:44:26,140 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 13
22:44:26,143 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 14
22:44:26,144 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 15
22:44:26,147 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 17
22:44:26,149 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 16
22:44:26,151 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 19
22:44:26,153 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 18
22:44:26,156 INFO [test] (Worker2_QueryProcessorQueue21) AbdPCQQAsiSL param 20
{code}