Re: proposal: PLpgSQL parallel assignemnt

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: PLpgSQL parallel assignemnt
Date: 2017-06-02 17:05:09
Message-ID: CAFj8pRBZ4qsx7mh_X-YfXesq_r-HTQusAWX2CdSft2wK66QLiA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2017-06-02 10:15 GMT+02:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:

>
>
> 2017-06-02 10:06 GMT+02:00 Craig Ringer <craig(at)2ndquadrant(dot)com>:
>
>> On 2 June 2017 at 15:51, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>>
>> > a, b := fx();
>> >
>> > Comments, notes, ideas?
>>
>> I'd be pretty happy to have
>>
>> (a, b) = (x, y);
>> (a, b) = f(x);
>>
>> which is SQL-esque.
>>
>
> This is not too far to my proposal - and it is fully adequate alternative.
>

The ANSI form is related to SET or UPDATE commands - so in this case I see
classic languages style
https://en.wikipedia.org/wiki/Assignment_(computer_science) better. The
assign statement in PLpgSQL is not related to embedded SQL. If we introduce
SQL syntax and SET commands for schema variables then ( ) syntax is
perfect, but for := PLpgSQL I am not sure

It is maybe strange, but

SET (a,b) = (SELECT a,b FROM foo)

a, b := fx()

are sentences from two independent worlds and different syntax can be
correct (depends how much we would to integrate procedural and SQL worlds
.. 100% T-SQL, 80% SQL/PSM, ..20% PLpgSQL or 5%PL/SQL)

Regards

Pavel

>
>
>>
>> But what, if anything, does Ada do?
>>
>
> What I know, no, Ada has not this statement - but the design of OUT
> parameters in Ada absolutely different than PostgreSQL - so in this case we
> cannot to use Ada language as our base :(
>
> Regards
>
> Pavel
>
>
>>
>> --
>> Craig Ringer http://www.2ndQuadrant.com/
>> PostgreSQL Development, 24x7 Support, Training & Services
>>
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2017-06-02 17:28:21 Re: Perfomance bug in v10
Previous Message Tom Lane 2017-06-02 16:59:45 Re: pg_class.relpartbound definition overly brittle