From: | Joel Jacobson <joel(at)trustly(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Christopher Browne <cbbrowne(at)gmail(dot)com>, Marko Tiikkaja <pgmail(at)joh(dot)to>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PL/PgSQL STRICT |
Date: | 2012-12-21 19:14:51 |
Message-ID: | CAASwCXcAc17DeVoY5YbYspFOnWRUmRmTK3Z3OQF+5EBBFLNOAg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Dec 21, 2012 at 4:53 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2012-12-21 19:21:37 | Re: Feature Request: pg_replication_master() |
Previous Message | Phil Sorber | 2012-12-21 19:07:20 | Re: [WIP] pg_ping utility |