Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id B6AF9B5DBBE for ; Wed, 7 Sep 2011 10:41:05 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 14087-01 for ; Wed, 7 Sep 2011 13:40:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vx0-f174.google.com (mail-vx0-f174.google.com [209.85.220.174]) by mail.postgresql.org (Postfix) with ESMTP id 65466B5DC0F for ; Wed, 7 Sep 2011 10:40:59 -0300 (ADT) Received: by vxj15 with SMTP id 15so356515vxj.19 for ; Wed, 07 Sep 2011 06:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=XW8BIuKzRMUQWU3hva9eeaoUf98+BwUsS4J6vetx5fI=; b=wC3GL1A3G3xFGDcVvrA3lUrVi4dgo+ffE3fbPVdwxOuOAhI2MvxbIJor0vy+jztkmg 2oVB8sik6OZ864mDv3CSsI+SBvepzZaXlk4E0gE7d2oHAuxk4TWCKlCn6yGIJ6GBeO9/ 1dmaaO60qfTuFRTXx2STsxK7s7gI8R59OTMAw= Received: by 10.220.147.201 with SMTP id m9mr258909vcv.56.1315402859140; Wed, 07 Sep 2011 06:40:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.182.69 with HTTP; Wed, 7 Sep 2011 06:40:19 -0700 (PDT) In-Reply-To: References: <201109070254.p872sd418092@momjian.us> From: Pavel Stehule Date: Wed, 7 Sep 2011 15:40:19 +0200 Message-ID: Subject: Re: [BUGS] documentation bug - behave of NEW a OLD in plpgsql's triggers To: Josh Kupershmidt Cc: Bruce Momjian , 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.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001 X-Spam-Level: X-Archive-Number: 201109/24 X-Sequence-Number: 6945 2011/9/7 Josh Kupershmidt : > On Tue, Sep 6, 2011 at 10:54 PM, Bruce Momjian wrote: >> Josh Kupershmidt wrote: >>> How about a doc tweak like the attached? >> >> Perfect. =C2=A0Applied to 9.0, 9.1, and head. =C2=A0Thanks. =C2=A0Sorry = for the delay. > > Err, as Tom's first comment in this thread explains, Pavel and I were > both wrong: the variables in question are indeed NULL, not undefined. > I think the docs were fine the way they were. There is maybe bug - these variables are defined, but they has not assigned tupledesc, so there is not possible do any test postgres=3D# create table omega (a int, b int); CREATE TABLE postgres=3D# create or replace function foo_trig() postgres-# returns trigger as $$ postgres$# begin postgres$# raise notice '%', new; postgres$# return null; postgres$# end; postgres$# $$ language plpgsql; CREATE FUNCTION postgres=3D# create trigger xxx after delete on omega for each row execute procedure foo_trig(); CREATE TRIGGER postgres=3D# insert into omega values(20); INSERT 0 1 postgres=3D# delete from omega; ERROR: record "new" is not assigned yet DETAIL: The tuple structure of a not-yet-assigned record is indeterminate. CONTEXT: PL/pgSQL function "foo_trig" line 3 at RAISE so current text in documentation is not correct too. Regards Pavel Stehule > > Josh >