Re: Stored procedures and out parameters - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: Stored procedures and out parameters
Date
Msg-id 5B8881A7.3060100@anastigmatix.net
Whole thread Raw
In response to Re: Stored procedures and out parameters  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Stored procedures and out parameters
List pgsql-hackers
On 08/30/18 15:35, Robert Haas wrote:
> On Tue, Aug 28, 2018 at 6:30 AM, Peter Eisentraut
> <peter.eisentraut@2ndquadrant.com> wrote:
>> CALL compatible with the SQL standard.  For example, if you have a
>> function f1(IN a int, OUT b int), you would call it as SELECT f1(x)
>> and the "b" would somehow be the return value.  But a procedure call
>> would be CALL p1(x, y), where x and y could be, say, PL/pgSQL
>> variables.

I suppose the key question for most driver writers is going to be,
what does that difference look like at the fe-be protocol level?
PL/pgSQL might be an unrepresentative example for that question,
as it lives in the backend and could have some other way of retrieving
b to store in y. For any remote client, the result still needs to get
back there before the client can apply any "this result gets assigned
to my y variable" semantics, and is there any material difference between
the protocol message sequences that return these results

  select foo(1,2);
  select * from foo(1,2);
  call bar(1,2);

to the client? And, in the parallel universe where functions got
implemented according to the standard, what in that picture would
be different?

-Chap


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_verify_checksums and -fno-strict-aliasing
Next
From: Michael Paquier
Date:
Subject: Re: pg_verify_checksums and -fno-strict-aliasing