Search Postgresql Archives

Re: basic trigger using OLD not working?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks much! That met with  partial success; but getting closer.

The error message about OLD went away (thankfully!), but there is still no data from the OLD variable. Here is the code again:

create trigger PEDIGREES_hist_del_trig
AFTER DELETE
on PEDIGREES
FOR EACH ROW
EXECUTE PROCEDURE logPedigreesDel();


CREATE OR REPLACE FUNCTION logPedigreesDel() RETURNS TRIGGER AS '
begin
    RAISE EXCEPTION ''OLD.famindid = '', OLD.famindid;
    return OLD;
end;
' LANGUAGE plpgsql;

Which when it fires results in:
cgb_lab_data=# \i testphdtrig.sql
psql:testphdtrig.sql:1: ERROR:  OLD.famindid =


Regards,
rick



Tom Lane wrote:
Rick Casey <rick.casey@xxxxxxxxxxxx> writes:
  
Here is the code that creates the delete trigger:
create trigger PEDIGREES_hist_del_trig
AFTER DELETE
on PEDIGREES
EXECUTE PROCEDURE logPedigreesDel();
    

I think you forgot FOR EACH ROW.  By default, the above creates a
STATEMENT trigger, in which you don't have access to individual rows.

			regards, tom lane
  

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux