Re: Relax requirement for INTO with SELECT in pl/pgsql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Relax requirement for INTO with SELECT in pl/pgsql
Дата
Msg-id 6820.1458600595@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Relax requirement for INTO with SELECT in pl/pgsql  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Ответы Re: Relax requirement for INTO with SELECT in pl/pgsql  (Merlin Moncure <mmoncure@gmail.com>)
Re: Relax requirement for INTO with SELECT in pl/pgsql  (Robert Haas <robertmhaas@gmail.com>)
Re: Relax requirement for INTO with SELECT in pl/pgsql  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Jim Nasby <Jim.Nasby@BlueTreble.com> writes:
> On 3/21/16 5:03 PM, Merlin Moncure wrote:
>> in Oracle, you'd simply do:
>> LogIt('I did something');

> It would be *great* if we could support that in plpgsql.

FWIW, I'm hesitant to just start accepting that syntax as if it were an
equivalent to "SELECT f(x)" or "PERFORM f(x)".  I think that someday
we will want to have the ability to have pass-by-reference parameters
to functions, and that's a fundamentally incompatible behavior so it
ought to be invoked by a new syntax.  I'd like to save "f(x)" as a
bare statement for that purpose.  We could also consider inventing
"CALL f(x)"; but supposing that we already had both "CALL f(x)" (which
would allow x to be pass-by-ref and possibly modified) and "SELECT f(x)"
(which would not), which one would you assign bare "f(x)" to mean?  It
should be "CALL f(x)", not least because that would be the semantics most
comparable to Oracle's behavior (since they have pass-by-ref parameters
already).

So, I'm -1 on not having any keyword at all.  I have no objection
to Merlin's proposal though.  I agree that PERFORM is starting to
look a bit silly, since it doesn't play with WITH for instance.

> While we're on the subject, it'd be great if variable := SELECT ... 
> worked too.

It does, though you might need parens around the sub-select.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: [PATCH] we have added support for box type in SP-GiST index
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: Relax requirement for INTO with SELECT in pl/pgsql