Re: Delete trigger and data integrity - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Delete trigger and data integrity
Date
Msg-id CAF-3MvPqy1HsfPehvTxVr8fZRe8m7ywoN+63sVGJKa=pfhMmUQ@mail.gmail.com
Whole thread Raw
In response to Delete trigger and data integrity  (Yvonne Zannoun <yvonne.zannoun@snowflakesoftware.com>)
List pgsql-general
On 27 May 2014 12:25, Yvonne Zannoun
<yvonne.zannoun@snowflakesoftware.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.


pgsql-general by date:

Previous
From: "Felix Kunde"
Date:
Subject: memory issues with BYTEAs in JSON and hstore
Next
From: Dmitry Samonenko
Date:
Subject: Fwd: libpq: indefinite block on poll during network problems