Re: proposal for 8.3: Simultaneous assignment for PL/pgSQL

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: proposal for 8.3: Simultaneous assignment for PL/pgSQL
Дата
Msg-id 44D8ACC3.6070408@dunslane.net
обсуждение исходный текст
Ответ на Re: proposal for 8.3: Simultaneous assignment for PL/pgSQL  ("Pavel Stehule" <pavel.stehule@hotmail.com>)
Ответы Re: proposal for 8.3: Simultaneous assignment for PL/pgSQL
Re: proposal for 8.3: Simultaneous assignment for PL/pgSQL
Список pgsql-hackers
Pavel Stehule wrote:
>
>> Tom Lane wrote:
>> > "Pavel Stehule" <pavel.stehule@hotmail.com> writes:
>> >> a,b,c := out3fce(1); -- Simultaneous assignment
>> >
>> > I thought we rejected that idea once already, on the grounds that it
>> > would make it too hard to tell the difference between intended code
>> > and typos.
>> >
>>
>> In any case, I had some questions:
>>
>> . is it compatible with PLSQL?
>> . can the effect be achieved by assigning to a composite?
>
> I looked into SQL2003, and SQL2003 knows it (SQL/PSM):
>
> <assignment statement> ::=
>    <singleton variable assignment>
>  | <multiple variable assignment>
> <multiple variable assignment> ::=
>    SET <assignment target list> <equals operator> <assigned row>
> <assignment target list> ::=
>    <left paren> <assignment target> [ { <comma> <assignment target> 
> }... ] <right paren>
> <singleton variable assignment> ::=
>    SET <assignment target> <equals operator> <assignment source>
>

The parentheses are apparently required for multiple variables, so in 
our case it might look like this:
 (a,b,c) := foo(bar);

That might overcome the objection Tom referred to, I guess?


cheers

andrew



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

Предыдущее
От: "Pavel Stehule"
Дата:
Сообщение: Re: proposal for PL packages for 8.3.
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: proposal for 8.3: Simultaneous assignment for PL/pgSQL