From: Marti Raudsepp <marti@juffo.org>
To: pgsql-docs <pgsql-docs@postgresql.org>
Subject: Document DELETE/UPDATE command tag vs triggers
Date: Sat, 17 Sep 2011 22:43:53 +0300
Message-ID: <CABRT9RAOE67OKF55n9+3ixw6-RiHhcvAUt2K-e49PUB0oZ8uWg@mail.gmail.com> (raw)
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
Attachments:0001-Document-DELETE-UPDATE-command-tag-vs-triggers.patch (text/x-patch, 2.4K) download
From e792a7a13fb703d077f2c5d901663e8c1391c6be Mon Sep 17 00:00:00 2001
From: Marti Raudsepp <marti@juffo.org>
Date: Sat, 17 Sep 2011 22:14:49 +0300
Subject: [PATCH] Document DELETE/UPDATE command tag vs triggers
---
doc/src/sgml/ref/delete.sgml | 10 ++++++----
doc/src/sgml/ref/update.sgml | 10 ++++++----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgmlindex 71ebeda..6366b15 100644--- a/doc/src/sgml/ref/delete.sgml+++ b/doc/src/sgml/ref/delete.sgml@@ -206,10 +206,12 @@ DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ [ AS ]
DELETE <replaceable class="parameter">count</replaceable>
</screen>
The <replaceable class="parameter">count</replaceable> is the number
- of rows deleted. If <replaceable class="parameter">count</replaceable> is- 0, no rows matched the <replaceable- class="parameter">condition</replaceable> (this is not considered- an error).+ of rows deleted. Note that the number may be less than the number of+ rows that matched the <replaceable+ class="parameter">condition</replaceable> when deletes were+ suppressed by a <literal>BEFORE DELETE</> trigger. If <replaceable+ class="parameter">count</replaceable> is 0, no rows were deleted by+ the query (this is not considered an error).
</para>
<para>
diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgmlindex ba5af8e..1c0e215 100644--- a/doc/src/sgml/ref/update.sgml+++ b/doc/src/sgml/ref/update.sgml@@ -226,10 +226,12 @@ UPDATE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ [ AS ] <rep
UPDATE <replaceable class="parameter">count</replaceable>
</screen>
The <replaceable class="parameter">count</replaceable> is the number
- of rows updated. If <replaceable class="parameter">count</replaceable> is- 0, no rows matched the <replaceable- class="parameter">condition</replaceable> (this is not considered- an error).+ 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).
</para>
<para>
--
1.7.6.1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: marti@juffo.org
Subject: Re: Document DELETE/UPDATE command tag vs triggers
In-Reply-To: <CABRT9RAOE67OKF55n9+3ixw6-RiHhcvAUt2K-e49PUB0oZ8uWg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox