Re: plpython trigger not working - Mailing list pgsql-general
From | Scott Chapman |
---|---|
Subject | Re: plpython trigger not working |
Date | |
Msg-id | 200306181859.01491.scott_list@mischko.com Whole thread Raw |
In response to | plpython trigger not working (Scott Chapman <scott_list@mischko.com>) |
List | pgsql-general |
I realized the problem after tinkering around a bunch. The trigger wasn't in place, only the function. Now the trigger is in place. Sorry to have bothered the list. Scott On Wednesday 18 June 2003 11:59, Scott Chapman wrote: > I'm trying to implement a plpython trigger so that I can use a third part > application, using Postgresql 7.3.3 on RH8.0, with Python 2.2.1. > It's supposed to change the 'modified' field to true whenever a record is > modified or added in this table: > > pilot-db=# \d timelog_data ; > Table "public.timelog_data" > Column | Type | Modifiers > -----------------+---------------------------+----------- > task | character varying(255) | > time | time(0) without time zone | > date | date | > palm_record_id | integer | > record_modified | boolean | > > Here's the trigger: > > pilot-db=# \df+ pilotdb* > List of > functions > Result data type | Schema | Name | Argument data types | Owner > > | Language | Source code | Description > > ------------------+--------+-----------------+---------------------+------- >---+----------+----------------------------------------------+------------- > "trigger" | public | pilotdb_trigger | | > postgres > > | plpython | TD["new"]["modified"] = "t"; return "MODIFY" | > > Here's the before and after: > pilot-db=# select * from timelog_data; > task | time | date | palm_record_id | record_modified > --------------+----------+------------+----------------+----------------- > Network | 11:14:00 | 2003-06-13 | 8933378 | f > Tech Support | 14:16:00 | 2003-06-13 | 8933379 | f > End Tasks | 14:16:00 | 2003-06-13 | 8933380 | f > End Tasks | 11:44:00 | 2003-06-15 | 8933377 | f > (4 rows) > > pilot-db=# update timelog_data SET date = '2003-06-16' where palm_record_id > = '8933377'; > UPDATE 1 > pilot-db=# select * from timelog_data; > task | time | date | palm_record_id | record_modified > --------------+----------+------------+----------------+----------------- > Network | 11:14:00 | 2003-06-13 | 8933378 | f > Tech Support | 14:16:00 | 2003-06-13 | 8933379 | f > End Tasks | 14:16:00 | 2003-06-13 | 8933380 | f > End Tasks | 11:44:00 | 2003-06-16 | 8933377 | f > (4 rows) > > Can anyone please help me understand what I'm missing here? > > Cordially, > Scott > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly
pgsql-general by date: