Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 287131337BD1 for ; Thu, 5 May 2011 23:32:33 -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 29563-03 for ; Fri, 6 May 2011 02:32:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f174.google.com (mail-iw0-f174.google.com [209.85.214.174]) by mail.postgresql.org (Postfix) with ESMTP id F2AA11337BCC for ; Thu, 5 May 2011 23:32:14 -0300 (ADT) Received: by iwn34 with SMTP id 34so2335023iwn.19 for ; Thu, 05 May 2011 19:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=mcy/MmxAdrgqSa83JGBnrgU8+NW/mzFH7eQFTIMWZ1M=; b=Ogz1calptKgjzy18p/q5f5qFZe63ZDzHKuTfkkRlPHjX9K2dOuywD7okuhrXYrjWjf iTJEj9mA9hMq+wFVdjg5e+N0C1qvbOqHMMHEKVnuOWDWsEMhjSjHl82Braytwo1mNvFE +qhA99Xz+Gdmo+6ZUw+8QktHqGSpZvqIbaRlk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=jr/bxcQd9ZKOy78Ex87QA3E+L703UoVCUt13b3/+M8AoBLrTUMXeK1UEEZ7R0339IZ 1OALDlvAQSWA2zlLRi4KiXcpYjQwAgSg/mJAygLvJKS6kAEpklRj7XAY8ipWu7xRurV/ vAlRwifKVmDPze+SwiR7WulkjTsCEJIpxN2Xk= Received: by 10.43.54.193 with SMTP id vv1mr1888158icb.338.1304649135096; Thu, 05 May 2011 19:32:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.165.70 with HTTP; Thu, 5 May 2011 19:31:35 -0700 (PDT) In-Reply-To: References: From: Pavel Stehule Date: Fri, 6 May 2011 04:31:35 +0200 Message-ID: Subject: Re: [BUGS] documentation bug - behave of NEW a OLD in plpgsql's triggers To: Josh Kupershmidt Cc: pgsql-docs Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/18 X-Sequence-Number: 6693 Hello 2011/5/6 Josh Kupershmidt : > [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 >> >> =C2=A0 =C2=A0Data 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 >> >> =C2=A0 =C2=A0Data 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: > | =C2=A0ERROR: =C2=A0record "new" is not assigned yet > | =C2=A0DETAIL: =C2=A0The tuple structure of a not-yet-assigned record is= indeterminate. > > How about a doc tweak like the attached? it is correct Regards Pavel Stehule > > Josh >