I suppose some workaround would be to introduce temporary cursor:
CREATE OR REPLACE FUNCTION A3() RETURNS VOID AS $BODY$
declare _tmp record;
begin
select * from A1() as dummy ( x double precision ) into _tmp;
end;
$BODY$ LANGUAGE 'plpgsql';
But I'm not sure if this is more effiecent than A3 r
Hi Ray, thanks for reply. Your solution needs to be modified with alias to get
executed properly:
CREATE OR REPLACE FUNCTION A3() RETURNS VOID AS $BODY$
begin
select * from A1() as dummy ( x double precision );
return;
end;
$BODY$ LANGUAGE 'plpgsql';
but when used: select * from A3() it genera
Hi Pavel, thanks for reply. Your solution:
CREATE OR REPLACE FUNCTION A3() RETURNS VOID AS $BODY$
begin
return query select * from A1();
return;
end;
$BODY$ LANGUAGE 'plpgsql';
generates error "cannot use RETURN QUERY in a non-SETOF function" because A3
returns VOID.
"Pavel Stehule" napisa
I have a function A1 that returns setof records, and I use it in two ways:
1) from function A2, where I need results from A1
2) from function A3, where I don't need these results, all I need is to
execute logic from A1
Here ale very simple versions of my functions:
CREATE OR REPLACE FUNCTION A1()