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