Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 7D8F1B5DBF6 for ; Tue, 6 Sep 2011 23:54:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 93952-06 for ; Wed, 7 Sep 2011 02:54:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id B9B62B5DBD0 for ; Tue, 6 Sep 2011 23:54:38 -0300 (ADT) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id p872sd418092; Tue, 6 Sep 2011 22:54:39 -0400 (EDT) From: Bruce Momjian Message-Id: <201109070254.p872sd418092@momjian.us> Subject: Re: [BUGS] documentation bug - behave of NEW a OLD in plpgsql's triggers In-Reply-To: To: Josh Kupershmidt Date: Tue, 6 Sep 2011 22:54:39 -0400 (EDT) CC: Pavel Stehule , pgsql-docs X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/21 X-Sequence-Number: 6942 Josh Kupershmidt wrote: > [Moving to -docs] > > On Mon, May 2, 2011 at 12:00 PM, Pavel Stehule 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 http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. +