Trigger problem

From: Henry Molina <henrymolina(at)cmn-consulting(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Trigger problem
Date: 2004-12-05 04:53:46
Message-ID: 1102222425.5133.33.camel@prometeo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all

I'm having a problem with PostgreSQL 7.4.6-2

I do:

drop table t1;
drop table t2;
create table t1 (id integer);
create table t2 (id integer);
CREATE OR REPLACE FUNCTION myfunc() RETURNS trigger AS '
BEGIN
insert into t2 values(NEW.id);
END;
' LANGUAGE plpgsql;

CREATE TRIGGER
mytri
AFTER INSERT ON t1 FOR EACH STATEMENT
EXECUTE PROCEDURE myfunc();
insert into t1 values(1);

and I get:

ERROR: record "new" is not assigned yet
DETAIL: The tuple structure of a not-yet-assigned record is
indeterminate.
CONTEXT: PL/pgSQL function "myfunc" line 2 at SQL statement

Thanks for you help!

--
Henry Molina
R&D
CMN Consulting

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2004-12-05 05:36:20 Re: Trigger problem
Previous Message Joe Conway 2004-12-05 01:58:41 Re: How can I expand serialized BLOBs into pseudo columns