Re: PL/pgSQL 2 - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: PL/pgSQL 2
Date
Msg-id 1409674147.64617.YahooMailNeo@web122304.mail.ne1.yahoo.com
Whole thread Raw
In response to Re: PL/pgSQL 2  (Joel Jacobson <joel@trustly.com>)
Responses Re: PL/pgSQL 2
List pgsql-hackers
Joel Jacobson <joel@trustly.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@trustly.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



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: PL/pgSQL 2
Next
From: Álvaro Hernández Tortosa
Date:
Subject: Re: PL/pgSQL 2