Re: [BUGS] documentation bug - behave of NEW a OLD in plpgsql's triggers

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: [BUGS] documentation bug - behave of NEW a OLD in plpgsql's triggers
Date: 2011-09-07 02:54:39
Message-ID: 201109070254.p872sd418092@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-docs

Josh Kupershmidt wrote:
> [Moving to -docs]
>
> On Mon, May 2, 2011 at 12:00 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> > Hello
> >
> > one czech user reported a bug in documentation -
> > http://www.postgresql.org/docs/8.4/static/plpgsql-trigger.html
> >
> > NEW
> >
> > ? ?Data type RECORD; variable holding the new database row for
> > INSERT/UPDATE operations in row-level triggers. This variable is NULL
> > in statement-level triggers and for DELETE operations.
> > OLD
> >
> > ? ?Data type RECORD; variable holding the old database row for
> > UPDATE/DELETE operations in row-level triggers. This variable is NULL
> > in statement-level triggers and for INSERT operations.
> >
> > It isn't correct. NEW is not declared in DELETE trigger, OLD isn't
> > declared in INSERT
>
> If I've understood you correctly, the problem is that the docs claim
> that the variables are defined with a value of NULL, when in fact they
> are undefined. For example, if you try to use variable NEW in a delete
> trigger, you'll get an error message like:
> | ERROR: record "new" is not assigned yet
> | DETAIL: The tuple structure of a not-yet-assigned record is indeterminate.
>
> How about a doc tweak like the attached?

Perfect. Applied to 9.0, 9.1, and head. Thanks. Sorry for the delay.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Rodriguez Fernando 2011-09-07 11:50:46 Re: In Windows Server 2008 PostgreSQL8.3 service on Local Computer started and then stopped.
Previous Message Bruce Momjian 2011-09-07 02:08:16 Re: Setting timezone: is it bug or intended?

Browse pgsql-docs by date

  From Date Subject
Next Message Josh Kupershmidt 2011-09-07 13:21:06 Re: [BUGS] documentation bug - behave of NEW a OLD in plpgsql's triggers
Previous Message Bruce Momjian 2011-09-06 16:40:54 Re: Migration page is out of date