PERFORM not working properly, please help..
От | wilczarz1@op.pl |
---|---|
Тема | PERFORM not working properly, please help.. |
Дата | |
Msg-id | Q17981249-b924cd6da17d52ddbecea39d9f10866e@pmq2.m5r2.onet.test.onet.pl обсуждение исходный текст |
Ответы |
Re: PERFORM not working properly, please help..
Re: PERFORM not working properly, please help.. |
Список | pgsql-general |
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() RETURNS setof record AS $BODY$
begin
-- some logic here
return query select col from tab;
end;
$BODY$ LANGUAGE 'plpgsql';
CREATE OR REPLACE FUNCTION A2() RETURNS setof record AS $BODY$
begin
-- some logic here
return query select * from A1() as dummy ( x double precision);
end;
$BODY$ LANGUAGE 'plpgsql';
CREATE OR REPLACE FUNCTION A3() RETURNS VOID AS $BODY$
begin
perform A1();
end;
$BODY$ LANGUAGE 'plpgsql';
And here are my function calls:
select * from A1() as(x double precision) --ok
select * from A2() as(x double precision) --ok
select * from A3(); --not ok, argh!
The last one generates error "set-valued function called in context that cannot accept a set". Why doesn't PERFORM work here? Thanks for help..
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() RETURNS setof record AS $BODY$
begin
-- some logic here
return query select col from tab;
end;
$BODY$ LANGUAGE 'plpgsql';
CREATE OR REPLACE FUNCTION A2() RETURNS setof record AS $BODY$
begin
-- some logic here
return query select * from A1() as dummy ( x double precision);
end;
$BODY$ LANGUAGE 'plpgsql';
CREATE OR REPLACE FUNCTION A3() RETURNS VOID AS $BODY$
begin
perform A1();
end;
$BODY$ LANGUAGE 'plpgsql';
And here are my function calls:
select * from A1() as(x double precision) --ok
select * from A2() as(x double precision) --ok
select * from A3(); --not ok, argh!
The last one generates error "set-valued function called in context that cannot accept a set". Why doesn't PERFORM work here? Thanks for help..
В списке pgsql-general по дате отправления: