Skip site navigation (1) Skip section navigation (2)

Document DELETE/UPDATE command tag vs triggers

From: Marti Raudsepp <marti(at)juffo(dot)org>
To: pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Document DELETE/UPDATE command tag vs triggers
Date: 2011-09-17 19:43:53
Message-ID: CABRT9RAOE67OKF55n9+3ixw6-RiHhcvAUt2K-e49PUB0oZ8uWg@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-docs
Hi list,

Currently the documentation for DELETE and UPDATE doesn't mention that
the number returned in the command tag is affected by triggers which
may suppress the change.

Worse, it currently states "If count is 0, no rows matched the
condition" which is incorrect -- the condition may have matched rows,
but the trigger might be suppressing the updates.

The new text says:

   The <replaceable class="parameter">count</replaceable> is the number
   of rows updated, including matched rows whose values did not change.
   Note that the number may be less than the number of rows that matched
   the <replaceable class="parameter">condition</replaceable> when
   updates were suppressed by a <literal>BEFORE UPDATE</> trigger.  If
   <replaceable class="parameter">count</replaceable> is 0, no rows were
   updated by the query (this is not considered an error).

Patch attached.

Regards,
Marti

Attachment: 0001-Document-DELETE-UPDATE-command-tag-vs-triggers.patch
Description: text/x-patch (2.4 KB)

Responses

pgsql-docs by date

Next:From: Robert HaasDate: 2011-09-19 19:01:55
Subject: Re: create foreign table
Previous:From: Ray StellDate: 2011-09-15 16:51:57
Subject: Re: create foreign table

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group