Skip to content

Instantly share code, notes, and snippets.

@leo-from-spb
Created October 23, 2017 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leo-from-spb/0a215163ddd8db3d3ce38168628f996f to your computer and use it in GitHub Desktop.
Save leo-from-spb/0a215163ddd8db3d3ce38168628f996f to your computer and use it in GitHub Desktop.
Postgres function result record
create function fun42(a integer, b integer, OUT c bigint, OUT d character varying)
returns record
language plpgsql
as $$
begin
c = a + b;
d = c::varchar;
end;
$$;
do $$
declare
x record;
begin
x = fun42(a := 1, b := 2);
raise notice 'c = %', x.c;
raise notice 'd = %', x.d;
end$$;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment