Re: BUG #18463: Possible bug in stored procedures with polymorphic OUT parameters
| От | Tom Lane |
|---|---|
| Тема | Re: BUG #18463: Possible bug in stored procedures with polymorphic OUT parameters |
| Дата | |
| Msg-id | 1800943.1715794137@sss.pgh.pa.us обсуждение |
| Ответ на | Re: BUG #18463: Possible bug in stored procedures with polymorphic OUT parameters (Dmitry Dolgov <9erthalion6@gmail.com>) |
| Ответы |
Re: BUG #18463: Possible bug in stored procedures with polymorphic OUT parameters
|
| Список | pgsql-bugs |
Dmitry Dolgov <9erthalion6@gmail.com> writes:
> I'm now curious why it is different for functions, when creating one
> with an INOUT ANYELEMENT argument and record return type will error out.
> Disabling the corresponding ereport check in CreateFunction seems to
> produce a function that works in the similar way as the procedure in
> this thread. Are those type of functions incorrect in some way?
With procedures, there's no explicit RETURNS clause; we just
automatically fill RECORD into prorettype because (a) we gotta
put something and (b) that's the right thing anyway if there's
multiple OUT parameters. Arguably it's not wrong for a single
output parameter, either, since CALL will return a tuple in
that case too. I think it might've been better to put VOID
for the case of zero output parameters, since CALL doesn't
return a zero-column tuple in that case. But that ship's
sailed, and it's not worth quibbling about.
We do this differently for functions: if there's exactly one
output parameter, that is the function result, so prorettype
has to match. If we were to allow RETURNS RECORD with a
single output parameter, I think that'd have to mean that
we return a one-column tuple containing that parameter value.
That's not implemented, and I have doubts that it'd be useful.
It'd certainly be a bit inefficient.
regards, tom lane
В списке pgsql-bugs по дате отправления: