Re: Trigger for Truncate event

From: Jignesh Shah <jignesh(dot)shah1980(at)gmail(dot)com>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Trigger for Truncate event
Date: 2009-08-27 08:07:07
Message-ID: c11950270908270107u5382b0a8x45c822bcff4381e2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thanks Kretschmer. Could you tell me what "return new" meant for?

Thanks,
Jigensh

On Thu, Aug 27, 2009 at 12:47 PM, A. Kretschmer <
andreas(dot)kretschmer(at)schollglas(dot)com> wrote:

> In response to Jignesh Shah :
> > Hi,
> >
> > Could any one please point me to TRUNCATE trigger PostgreSQL example?
> >
> > Thanks,
>
> test=# create table jignesh (i int);
> CREATE TABLE
> test=*# create function trg_jignesh() returns trigger as $$begin raise
> notice 'in the function'; return new; end;$$ language plpgsql;
> CREATE FUNCTION
> test=*# create trigger trg1 before truncate on jignesh for each statement
> execute procedure trg_jignesh();
> CREATE TRIGGER
> test=*# create trigger trg2 after truncate on jignesh for each statement
> execute procedure trg_jignesh();
> CREATE TRIGGER
> test=*# truncate jignesh ;
> NOTICE: in the function
> NOTICE: in the function
> TRUNCATE TABLE
>
>
> ROLLBACK, Andreas
> --
> Andreas Kretschmer
> Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
> GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
>
> --
> Sent via pgsql-novice mailing list (pgsql-novice(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message A. Kretschmer 2009-08-27 08:17:32 Re: Trigger for Truncate event
Previous Message Jignesh Shah 2009-08-27 07:36:28 Re: how can I finish my suscription?