mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Add PL/PgSQL FOUND and GET DIAGNOSTICS support for RETURN QUERY
statement Pavel Stehule
This commit is contained in:
@@ -2948,3 +2948,27 @@ $$ language plpgsql immutable strict;
|
||||
select * from tftest(10);
|
||||
|
||||
drop function tftest(int);
|
||||
|
||||
create or replace function rttest()
|
||||
returns setof int as $$
|
||||
declare rc int;
|
||||
begin
|
||||
return query values(10),(20);
|
||||
get diagnostics rc = row_count;
|
||||
raise notice '% %', found, rc;
|
||||
return query select * from (values(10),(20)) f(a) where false;
|
||||
get diagnostics rc = row_count;
|
||||
raise notice '% %', found, rc;
|
||||
return query execute 'values(10),(20)';
|
||||
get diagnostics rc = row_count;
|
||||
raise notice '% %', found, rc;
|
||||
return query execute 'select * from (values(10),(20)) f(a) where false';
|
||||
get diagnostics rc = row_count;
|
||||
raise notice '% %', found, rc;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
select * from rttest();
|
||||
|
||||
drop function rttest();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user