From: | Scott Chapman <scott_list(at)mischko(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | plpython trigger not working |
Date: | 2003-06-18 18:59:04 |
Message-ID: | 200306181159.04200.scott_list@mischko.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | scott.marlowe | 2003-06-18 19:00:48 | Re: PostgreSQL alternative to "Oracle Real Application |
Previous Message | Travis Hume | 2003-06-18 18:57:23 | Re: can't "grant all on database..." |