Re: PL/pgSQL 2

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Joel Jacobson <joel(at)trustly(dot)com>
Cc: Marko Tiikkaja <marko(at)joh(dot)to>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/pgSQL 2
Date: 2014-09-02 16:09:07
Message-ID: 1409674147.64617.YahooMailNeo@web122304.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joel Jacobson <joel(at)trustly(dot)com> wrote:

> The common use-case I have in mind is when you have a function which
> takes some kind of ID as an input param, which maps to a primary key
> in some table, which you want to update.
> If the where-clause would be incorrect and the update would update all
> rows in the table, that would be a disaster, which is what I want to
> prevent.

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.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Hernández Tortosa 2014-09-02 16:11:26 Re: PL/pgSQL 2
Previous Message Heikki Linnakangas 2014-09-02 16:03:42 Re: PL/pgSQL 2