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