plpython triggers TD["new"] = None - Mailing list pgsql-bugs

From Lee Jensen
Subject plpython triggers TD["new"] = None
Date
Msg-id 41F96787.3070806@carriersales.com
Whole thread Raw
Responses Re: plpython triggers TD["new"] = None  (Michael Fuhr <mike@fuhr.org>)
Re: plpython triggers TD["new"] = None  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-bugs
I have postgres 7.4.6 installed on 2 machines one debian and one
freebsd. Both are the most recent installs of each OS. On both I have
the plpython module and both are having the same issue. Essentially when
a function is called from a trigger the TD tuple get's populated with
all the standard data except new and old have no value (None). Here is
the function code I am working with:

CREATE OR REPLACE FUNCTION public.test_trigger() RETURNS trigger AS
'
plpy.error(TD)

return "OK"
' LANGUAGE 'plpythonu';

The actual trigger is defined as follows:
CREATE TRIGGER trig
  BEFORE INSERT OR UPDATE
  ON public.test
  FOR EACH STATEMENT
  EXECUTE PROCEDURE public.test_trigger();

The following error is generated on both machines when an insert occurs:
ERROR:  plpython: function "test_trigger" failed
DETAIL:  plpy.Error: ({'relid': '17246', 'old': None, 'name': 'trig',
'level': 'STATEMENT', 'args': None, 'when': 'BEFORE', 'new': None,
'event': 'INSERT'},)

Any help would be appreciated. Most likely I've done something wrong
somewhere.

Lee

pgsql-bugs by date:

Previous
From: Tamas Vincze
Date:
Subject: Re: 8.0.0 make check fails on Solaris 9 (sparc)
Next
From: Michael Fuhr
Date:
Subject: Re: 8.0.0 make check fails on Solaris 9 (sparc)