From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | Philipp Kraus <philipp(dot)kraus(at)flashpixx(dot)de> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: pass NEW / OLD variable in trigger to table |
Date: | 2012-06-09 14:30:14 |
Message-ID: | 4FD35DF6.7060201@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 06/09/2012 05:49 AM, Philipp Kraus wrote:
> Hello,
>
> I'm using some trigger functions on a view. Can I pass the NEW / OLD variable to the table of the view?
> An excerpt of my view shows:
>
> IF TG_OP = 'INSERT' then
> insert into mytable (name, data, commentdata, history) values (NEW.name, NEW.data, NEW.commentdata, NEW.history);
> ernd if;
>
> Can I do anything like "insert into mytable values (NEW)" ? Can I do this with update and delete also?
> I would like to pass the variable with the "action" to the table, so I need not to reference the fields
http://www.postgresql.org/docs/9.1/interactive/plpgsql-trigger.html
See Example 39-4. A PL/pgSQL Trigger Procedure For Auditing
>
> Thanks
>
> Phil
>
>
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-06-09 15:18:00 | Re: Extending SQL C-language multidimension arrays |
Previous Message | Chris Travers | 2012-06-09 13:56:44 | Re: Extension table data |