Re: INOUT parameters in procedures

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: INOUT parameters in procedures
Date: 2018-03-20 21:28:04
Message-ID: CAHyXU0wnJz1yATUQxc7rrb-7rJAbkYQyLq+b=KSGYh8F19nFVg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 20, 2018 at 4:19 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> A) you can't assign output variables with into:
> CALL p(1) INTO i; // gives syntax error
>
> B) you can't assign via assignment
> i := p(1); // gives error, 'use CALL'
>
> C) but you *can* via execute
> EXECUTE 'CALL p(1)' INTO i; // this works!
>
> ...I'm glad 'C' works, as without that there would be no useful way to
> get values out of procedures called from within other
> procedures/functions as things stand today. 'A' ideally also out to
> work, but I'm not sure 'B' should be expected to work since it's
> really a thin layer around SELECT. What do you think?

Also (sorry for spam),
A procedure created via:
create procedure p() as $$begin call p(); end; $$ language plpgsql;
...will segfault when called -- there ought to be a stack depth check.

merlin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-03-20 21:29:07 Re: [HACKERS] path toward faster partition pruning
Previous Message Julian Markwort 2018-03-20 21:25:01 Re: [HACKERS] [FEATURE PATCH] pg_stat_statements with plans (v02)