From: | Alban Hertroys <haramrae(at)gmail(dot)com> |
---|---|
To: | Yvonne Zannoun <yvonne(dot)zannoun(at)snowflakesoftware(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Delete trigger and data integrity |
Date: | 2014-05-27 11:25:19 |
Message-ID: | CAF-3MvPqy1HsfPehvTxVr8fZRe8m7ywoN+63sVGJKa=pfhMmUQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 27 May 2014 12:25, Yvonne Zannoun
<yvonne(dot)zannoun(at)snowflakesoftware(dot)com> wrote:
> CREATE OR REPLACE FUNCTION delete_records()
> RETURNS TRIGGER AS $$
> BEGIN
> delete from "TABLE";
> RETURN NEW;
> END;
> $$
> LANGUAGE plpgsql;
You can't return NEW in an ON DELETE trigger - there is no NEW record.
Since you're going with a STATEMENT trigger instead, that's not really
relevant anymore (no NEW _or_ OLD record, since statements aren't
necessarily involved with single records), but I thought I'd mention
that slight oversight ;)
--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Samonenko | 2014-05-27 12:36:08 | Fwd: libpq: indefinite block on poll during network problems |
Previous Message | Felix Kunde | 2014-05-27 11:19:33 | memory issues with BYTEAs in JSON and hstore |