public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pavel Stehule <[email protected]>
To: Josh Kupershmidt <[email protected]>
Cc: Bruce Momjian <[email protected]>
Cc: pgsql-docs <[email protected]>
Subject: Re: [BUGS] documentation bug - behave of NEW a OLD in plpgsql's triggers
Date: Wed, 7 Sep 2011 15:40:19 +0200
Message-ID: <CAFj8pRCfe6doaipkG7h_Pvr5vR0+4qArwxda7ZQTKruG5s0DfQ@mail.gmail.com> (raw)
In-Reply-To: <CAK3UJRH+cQwHr9EBUYBx3VVhD6fur6v8w28PzjhWohNKYV-rbA@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CAK3UJRH+cQwHr9EBUYBx3VVhD6fur6v8w28PzjhWohNKYV-rbA@mail.gmail.com>

2011/9/7 Josh Kupershmidt <[email protected]>:
> On Tue, Sep 6, 2011 at 10:54 PM, Bruce Momjian <[email protected]> wrote:
>> Josh Kupershmidt wrote:
>>> How about a doc tweak like the attached?
>>
>> Perfect.  Applied to 9.0, 9.1, and head.  Thanks.  Sorry 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=# create table omega (a int, b int);
CREATE TABLE
postgres=# 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=# create trigger xxx after delete on omega for each row
execute procedure foo_trig();
CREATE TRIGGER
postgres=# insert into omega values(20);
INSERT 0 1
postgres=# 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
>



view thread (11+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: [BUGS] documentation bug - behave of NEW a OLD in plpgsql's triggers
  In-Reply-To: <CAFj8pRCfe6doaipkG7h_Pvr5vR0+4qArwxda7ZQTKruG5s0DfQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox