From: | "Plugge, Joe R(dot)" <JRPlugge(at)west(dot)com> |
---|---|
To: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Column Specific Update Trigger Routine |
Date: | 2010-05-06 20:51:37 |
Message-ID: | BD69807DAE0CE44CA00A8338D0FDD08302D2654152@oma00cexmbx03.corp.westworlds.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Nevermind all, I figured it out ....
Thanks Dmitriy ...
From: Dmitriy Igrishin [mailto:dmitigr(at)gmail(dot)com]
Sent: Thursday, May 06, 2010 3:25 PM
To: Plugge, Joe R.
Subject: Re: [SQL] Column Specific Update Trigger Routine
Hey Plugge,
You dont need to pass OLD.* or NEW.* to the trigger function.
These structures available from within trigger function.
Note, that in PostgreSQL 9 you will able to create trigger
which call function only when some column of the table
affected.
Regards,
Dmitriy
2010/5/7 Plugge, Joe R. <JRPlugge(at)west(dot)com<mailto:JRPlugge(at)west(dot)com>>
I am trying to create a update trigger on a table that basically will only fire when a specific column is updated. I am using version 8.4.3.
My plan of attack was to always fire on any row update, and pass in the OLD and NEW column that I want to check.
CREATE TRIGGER check_lockout
AFTER UPDATE ON acct_table
FOR EACH ROW
EXECUTE PROCEDURE acct_unlock(OLD.userid,OLD.ownerid,OLD.password,NEW.password);
This fails with :
[postgres(at)linux1505 ~]$ cat check_lockout_trig.sql | psql testdb
ERROR: syntax error at or near "OLD"
LINE 4: EXECUTE PROCEDURE acct_unlock(OLD.userid,OLD.ownerid,OLD.password,NEW.password);
What am I doing wrong? Or is there a better way to go about this?
From | Date | Subject | |
---|---|---|---|
Next Message | Justin Graf | 2010-05-06 20:59:16 | Re: Column Specific Update Trigger Routine |
Previous Message | Plugge, Joe R. | 2010-05-06 20:12:32 | Column Specific Update Trigger Routine |