Today,I defined a function,using the insert statements in a loop. But HAWQ returned an error:
ERROR: could not serialize unrecognized node type: 43983632 (outfast.c:4742)
CONTEXT: SQL statement "insert into t(id,value) values(1,0.1)"
PL/pgSQL function "test_function" line 6 at SQL statement
I did some testing and found that when I use the 'insert statements' in the loop,it will be reported as a mistake. If I delete the relevant 'insert statements',It can run properly.
Here is an example of a test:
CREATE OR REPLACE FUNCTION test_function()
RETURNS int AS
$BODY$
declare
number int;
begin
number := 1;
while number <= 10 loop
insert into t(id,value) values(1,0.1);
number := number+1;
end loop;
return number;
end
$BODY$
LANGUAGE plpgsql ;
Then I use 'select test_function();' to call the function.It will returned an error mentioned above.
Does this mean that I can not use the SQL statements in a loop with plpgsql ?
Thanks. Best regards.