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 17:37:45
Message-ID: c11950270908271037h50fa422ds57dcc20664d2a6e9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thanks Andreas, when I tried to create trigger it gives me error. Could you
tell me what is wrong?

mydb=# CREATE TRIGGER truncate_trigger
mydb-# AFTER TRUNCATE ON mytable
mydb-# FOR EACH STATEMENT EXECUTE PROCEDURE my_test();
ERROR: syntax error at or near "TRUNCATE" at character 52
LINE 2: AFTER TRUNCATE ON mytable
Thanks,
Jignesh

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

> In response to Jignesh Shah :
> > Thanks Kretschmer. Could you tell me what "return new" meant for?
>
> A trigger function must return either NULL or a record/row value having
> exactly the structure of the table the trigger was fired for. Okay, in
> this case, you can also return NULL. NEW means the new record, but you
> need it only for row level triggers afaik.
>
>
> Regards, 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 Steve T 2009-08-27 17:38:29 Re: Speeding up 'bulk' delete (and/or seeing what is going on while the delete is being processed)
Previous Message Tom Lane 2009-08-27 17:17:56 Re: Speeding up 'bulk' delete (and/or seeing what is going on while the delete is being processed)