Re: PL/PgSQL STRICT
Joel Jacobson <joel@trustly.com>
From: Joel Jacobson <joel@trustly.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Christopher Browne <cbbrowne@gmail.com>, Marko Tiikkaja <pgmail@joh.to>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2012-12-21T19:14:51Z
Lists: pgsql-hackers
On Fri, Dec 21, 2012 at 4:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > That was my first reaction too, but Marko's followon examples seem to > make a reasonable case for it. There are many situations where you > expect an UPDATE or DELETE to hit exactly one row. Often, programmers > won't bother to add code to check that it did ... but if a one-word > addition to the command can provide such a check, it seems more likely > that they would add the check. Very true. When I was a PL/PgSQL beginner a few years ago I did exactly that, I didn't check if the update actually updated any row, I didn't know it could fail, and felt extremely worried and stupid when I realised this. I spent an entire day going through all functions fixing this problem at all places. The fix was not beautiful and it bugged me there was not a prettier way to fix it.