From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Khangelani Gama <kgama(at)argility(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Need help on triggers - postgres 9.1.2 |
Date: | 2014-05-21 13:20:10 |
Message-ID: | 537CA80A.1010301@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 05/21/2014 02:54 AM, Khangelani Gama wrote:
> Hi
>
> I have a postgres 9 database, inside this database I need to create a
> new table called *center_changed* that gets inserted by any change that
> take place in a table called *center*. So I need to create trigger to do
> this.
>
> *Example: *
>
> Table name*: center*(c_cde, c_dsc, ops_cde, grp_cde);
>
> Now on the table called *center , *I need to create an INSERT and UPDATE
> trigger will insert the *c_cde * of the inserted or updated *center*
> into the *center_changed* table
>
> Please help me
>
> I have this syntax below, but please help me with the overall query.
>
> CREATE TRIGGER check_center
>
> BEFORE INSERT OR UPDATE
>
> ON *cente*r FOR EACH ROW
>
> EXECUTE PROCEDURE check_center_changes();
See here:
http://www.postgresql.org/docs/9.3/interactive/plpgsql-trigger.html
Example 40-4. A PL/pgSQL Trigger Procedure For Auditing
>
> Thanks
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Stuart Bishop | 2014-05-21 14:39:05 | pgtune and massive shared_buffers recommendation |
Previous Message | Jürgen Fuchsberger | 2014-05-21 11:24:15 | Re: LDAP authentication not working |