pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Document DELETE/UPDATE command tag vs triggers
9+ messages / 4 participants
[nested] [flat]

* Document DELETE/UPDATE command tag vs triggers
@ 2011-09-17 19:43 Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:12 ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  0 siblings, 1 reply; 9+ messages in thread

From: Marti Raudsepp @ 2011-09-17 19:43 UTC (permalink / raw)
  To: 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

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.sgml index 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.sgml index 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
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: Document DELETE/UPDATE command tag vs triggers
  2011-09-17 19:43 Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
@ 2011-09-25 13:12 ` Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:35   ` Re: Document DELETE/UPDATE command tag vs triggers Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Marti Raudsepp @ 2011-09-25 13:12 UTC (permalink / raw)
  To: pgsql-docs

On Sat, Sep 17, 2011 at 22:43, Marti Raudsepp <marti@juffo.org> wrote:
> 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.

Bump! What's the right procedure for submitting documentation patches?
The CommitFest app doesn't have a "documentation" category.

Regards,
Marti



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Document DELETE/UPDATE command tag vs triggers
  2011-09-17 19:43 Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:12 ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
@ 2011-09-25 13:35   ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  2011-10-10 16:58     ` Re: Document DELETE/UPDATE command tag vs triggers Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Heikki Linnakangas @ 2011-09-25 13:35 UTC (permalink / raw)
  To: Marti Raudsepp <marti@juffo.org>; +Cc: pgsql-docs

On 25.09.2011 16:12, Marti Raudsepp wrote:
> Bump! What's the right procedure for submitting documentation patches?
> The CommitFest app doesn't have a "documentation" category.

Feel free to add one. The categories, or topics, are editable: click on 
the "CommitFest Topics" link near the top-right corner, next to the "New 
Patch" link. Then "New Topic".

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Document DELETE/UPDATE command tag vs triggers
  2011-09-17 19:43 Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:12 ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:35   ` Re: Document DELETE/UPDATE command tag vs triggers Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
@ 2011-10-10 16:58     ` Robert Haas <robertmhaas@gmail.com>
  2011-10-12 08:39       ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  0 siblings, 1 reply; 9+ messages in thread

From: Robert Haas @ 2011-10-10 16:58 UTC (permalink / raw)
  To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; +Cc: Marti Raudsepp <marti@juffo.org>; pgsql-docs

On Sun, Sep 25, 2011 at 9:35 AM, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> On 25.09.2011 16:12, Marti Raudsepp wrote:
>>
>> Bump! What's the right procedure for submitting documentation patches?
>> The CommitFest app doesn't have a "documentation" category.
>
> Feel free to add one. The categories, or topics, are editable: click on the
> "CommitFest Topics" link near the top-right corner, next to the "New Patch"
> link. Then "New Topic".

Committed.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Document DELETE/UPDATE command tag vs triggers
  2011-09-17 19:43 Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:12 ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:35   ` Re: Document DELETE/UPDATE command tag vs triggers Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  2011-10-10 16:58     ` Re: Document DELETE/UPDATE command tag vs triggers Robert Haas <robertmhaas@gmail.com>
@ 2011-10-12 08:39       ` Marti Raudsepp <marti@juffo.org>
  2011-10-12 16:48         ` Re: Document DELETE/UPDATE command tag vs triggers Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Marti Raudsepp @ 2011-10-12 08:39 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; pgsql-docs

On Mon, Oct 10, 2011 at 19:58, Robert Haas <robertmhaas@gmail.com> wrote:
> Committed.

Thanks!

Do you think it should be backported to earlier versions too? As it
stands, the documentation is misleading.

Regards,
Marti



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Document DELETE/UPDATE command tag vs triggers
  2011-09-17 19:43 Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:12 ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:35   ` Re: Document DELETE/UPDATE command tag vs triggers Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  2011-10-10 16:58     ` Re: Document DELETE/UPDATE command tag vs triggers Robert Haas <robertmhaas@gmail.com>
  2011-10-12 08:39       ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
@ 2011-10-12 16:48         ` Robert Haas <robertmhaas@gmail.com>
  2011-10-12 17:57           ` Re: Document DELETE/UPDATE command tag vs triggers Bruce Momjian <bruce@momjian.us>
  2011-10-12 18:27           ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  0 siblings, 2 replies; 9+ messages in thread

From: Robert Haas @ 2011-10-12 16:48 UTC (permalink / raw)
  To: Marti Raudsepp <marti@juffo.org>; +Cc: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; pgsql-docs

On Wed, Oct 12, 2011 at 4:39 AM, Marti Raudsepp <marti@juffo.org> wrote:
> On Mon, Oct 10, 2011 at 19:58, Robert Haas <robertmhaas@gmail.com> wrote:
>> Committed.
>
> Thanks!
>
> Do you think it should be backported to earlier versions too? As it
> stands, the documentation is misleading.

Well, I committed about five doc patches that day, and I had to decide
for each one whether it was worth back-patching, and if so whether it
was worth back-patching all the way or just to 9.1.  (We typically
back-patch things to all applicable versions or not at all, but for
doc changes sometimes we go back exactly one release so that it will
make its way onto the most current version of the web site docs a
little bit more quickly.)  I decided against back-patching this one,
on the theory that we make many documentation improvements over the
course of every major release cycle, and back-patching all of them
creates more work for translators than can really be justified by the
small number of people who read older versions of the documentation.
It's an arguable point, of course, and I wouldn't have objected if
someone else had chosen differently.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Document DELETE/UPDATE command tag vs triggers
  2011-09-17 19:43 Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:12 ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:35   ` Re: Document DELETE/UPDATE command tag vs triggers Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  2011-10-10 16:58     ` Re: Document DELETE/UPDATE command tag vs triggers Robert Haas <robertmhaas@gmail.com>
  2011-10-12 08:39       ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-10-12 16:48         ` Re: Document DELETE/UPDATE command tag vs triggers Robert Haas <robertmhaas@gmail.com>
@ 2011-10-12 17:57           ` Bruce Momjian <bruce@momjian.us>
  1 sibling, 0 replies; 9+ messages in thread

From: Bruce Momjian @ 2011-10-12 17:57 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Marti Raudsepp <marti@juffo.org>; Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; pgsql-docs

Robert Haas wrote:
> On Wed, Oct 12, 2011 at 4:39 AM, Marti Raudsepp <marti@juffo.org> wrote:
> > On Mon, Oct 10, 2011 at 19:58, Robert Haas <robertmhaas@gmail.com> wrote:
> >> Committed.
> >
> > Thanks!
> >
> > Do you think it should be backported to earlier versions too? As it
> > stands, the documentation is misleading.
> 
> Well, I committed about five doc patches that day, and I had to decide
> for each one whether it was worth back-patching, and if so whether it
> was worth back-patching all the way or just to 9.1.  (We typically
> back-patch things to all applicable versions or not at all, but for
> doc changes sometimes we go back exactly one release so that it will
> make its way onto the most current version of the web site docs a
> little bit more quickly.)  I decided against back-patching this one,
> on the theory that we make many documentation improvements over the
> course of every major release cycle, and back-patching all of them
> creates more work for translators than can really be justified by the
> small number of people who read older versions of the documentation.
> It's an arguable point, of course, and I wouldn't have objected if
> someone else had chosen differently.

I agree with your analysis.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Document DELETE/UPDATE command tag vs triggers
  2011-09-17 19:43 Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:12 ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:35   ` Re: Document DELETE/UPDATE command tag vs triggers Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  2011-10-10 16:58     ` Re: Document DELETE/UPDATE command tag vs triggers Robert Haas <robertmhaas@gmail.com>
  2011-10-12 08:39       ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-10-12 16:48         ` Re: Document DELETE/UPDATE command tag vs triggers Robert Haas <robertmhaas@gmail.com>
@ 2011-10-12 18:27           ` Marti Raudsepp <marti@juffo.org>
  2011-10-12 19:34             ` Re: Document DELETE/UPDATE command tag vs triggers Robert Haas <robertmhaas@gmail.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Marti Raudsepp @ 2011-10-12 18:27 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; pgsql-docs

On Wed, Oct 12, 2011 at 19:48, Robert Haas <robertmhaas@gmail.com> wrote:
> Well, I committed about five doc patches that day, and I had to decide
> for each one whether it was worth back-patching,

> I decided against back-patching this one

Sounds fair.

For what it's worth, I wasn't doubting your judgement. Just that it
wasn't clear to me whether you had considered backpatching or not.

Regards,
Marti



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Document DELETE/UPDATE command tag vs triggers
  2011-09-17 19:43 Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:12 ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-09-25 13:35   ` Re: Document DELETE/UPDATE command tag vs triggers Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  2011-10-10 16:58     ` Re: Document DELETE/UPDATE command tag vs triggers Robert Haas <robertmhaas@gmail.com>
  2011-10-12 08:39       ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
  2011-10-12 16:48         ` Re: Document DELETE/UPDATE command tag vs triggers Robert Haas <robertmhaas@gmail.com>
  2011-10-12 18:27           ` Re: Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
@ 2011-10-12 19:34             ` Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Robert Haas @ 2011-10-12 19:34 UTC (permalink / raw)
  To: Marti Raudsepp <marti@juffo.org>; +Cc: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; pgsql-docs

On Wed, Oct 12, 2011 at 2:27 PM, Marti Raudsepp <marti@juffo.org> wrote:
> On Wed, Oct 12, 2011 at 19:48, Robert Haas <robertmhaas@gmail.com> wrote:
>> Well, I committed about five doc patches that day, and I had to decide
>> for each one whether it was worth back-patching,
>
>> I decided against back-patching this one
>
> Sounds fair.
>
> For what it's worth, I wasn't doubting your judgement. Just that it
> wasn't clear to me whether you had considered backpatching or not.

Hmm, I probably could've clarified that in my email instead of just
saying "Committed".  Will try to remember that next time.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2011-10-12 19:34 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-09-17 19:43 Document DELETE/UPDATE command tag vs triggers Marti Raudsepp <marti@juffo.org>
2011-09-25 13:12 ` Marti Raudsepp <marti@juffo.org>
2011-09-25 13:35   ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2011-10-10 16:58     ` Robert Haas <robertmhaas@gmail.com>
2011-10-12 08:39       ` Marti Raudsepp <marti@juffo.org>
2011-10-12 16:48         ` Robert Haas <robertmhaas@gmail.com>
2011-10-12 17:57           ` Bruce Momjian <bruce@momjian.us>
2011-10-12 18:27           ` Marti Raudsepp <marti@juffo.org>
2011-10-12 19:34             ` Robert Haas <robertmhaas@gmail.com>

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