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

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

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: documentation bug - behave of NEW a OLD in plpgsql's triggers
Date: 2011-05-06 00:56:36
Message-ID: BANLkTikzDpBjvUmkoYFWQVPDOdmYX=KFKw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-docs
[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?

Josh

Attachment: plpgsql_triggers.patch
Description: text/x-patch (1.7 KB)

In response to

Responses

pgsql-docs by date

Next:From: Pavel StehuleDate: 2011-05-06 02:31:35
Subject: Re: [BUGS] documentation bug - behave of NEW a OLD in plpgsql's triggers
Previous:From: Bruce MomjianDate: 2011-05-05 16:25:09
Subject: Re: characters or bytes?

pgsql-bugs by date

Next:From: Pavel StehuleDate: 2011-05-06 02:31:35
Subject: Re: [BUGS] documentation bug - behave of NEW a OLD in plpgsql's triggers
Previous:From: Bruce MomjianDate: 2011-05-05 22:12:04
Subject: Re: Re: [BUGS] BUG #5957: createdb with description and md5 auth forces to provide password twice

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