Re: Trigger for Truncate event

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Trigger for Truncate event
Date: 2009-08-27 07:17:06
Message-ID: 20090827071705.GE9779@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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

In response to

Responses

Browse pgsql-novice by date

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