Re: PL/pgSQL 2

From: Álvaro Hernández Tortosa <aht(at)nosys(dot)es>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PL/pgSQL 2
Date: 2014-09-02 16:31:00
Message-ID: 5405F0C4.9050505@nosys.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 02/09/14 18:20, Joel Jacobson wrote:
> On Tue, Sep 2, 2014 at 6:09 PM, Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:
>> Joel Jacobson <joel(at)trustly(dot)com> wrote:
>>
>>> Sorry for being unclear, I didn't mean to suggest the main concern is
>>> updating *all* rows.
>>> The main concern is when you have a rather complex UPDATE WHERE clause,
>>> aiming to update exactly one row. Some of the expressions might be
>>> assertions, to just double-verify the values and to make it stand-out
>>> you are checking those expressions.
>>
>> These are two different problems which probably need two different
>> solutions. Making the default behavior of a set-based command that
>> it throw an error if the resulting set is not exactly one row
>> doesn't seem like the right solution to either one of them.
> I see your point.
> Basically, we have two types of applications where PL/pgSQL is commonly used.
> a) OLTP applications where you typically operate on one row for each
> UPDATE command.
> b) Data warehouseing applications where you process multiple rows in
> each UPDATE command.
>
> Both have different desired default behaviours of the different
> set-based commands used in PL/pgSQL.
> I think both are important enough to motivate a nice syntax for both use-cases.
> If we cannot change the default behaviour of UPDATE, then I vote for
> the eariler proposed STRICT UPDATE syntax.

I see both use cases, but I think the SQL default are set
operations. For this particular point, if there would be just a syntax
change rather than a new language, in the line of the "ONE ROW UPDATE"
syntax, I'd say "UNIQUE UPDATE". This {ONE ROW, UNIQUE} syntax may also
enforce having a WHERE clause. I find both better than the STRICT, which
is not doing what -you may think- it does.

Regards,

Álvaro

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-09-02 16:31:43 Re: PL/pgSQL 2
Previous Message Pavel Stehule 2014-09-02 16:28:35 Re: PL/pgSQL 2