Re: Fwd: Trigger on VIEW not firing

From: Beena Emerson <memissemerson(at)gmail(dot)com>
To: Massimo Costantini <massimo(dot)costantini(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Fwd: Trigger on VIEW not firing
Date: 2013-07-30 12:55:40
Message-ID: CAOG9ApHgAssXV_fOv990Nd7Cjy9S5y-CUp78cvXN7+R8bnMDLw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgeu-general pgsql-general

The trigger is on the view and fires when you query the view:

# DELETE FROM worksub;
NOTICE: UPDATE VIEW FROM: worksub OPERATION: DELETE
ERROR: control reached end of trigger procedure without RETURN
CONTEXT: PL/pgSQL function wrk_view()

On Tue, Jul 30, 2013 at 6:10 PM, Massimo Costantini <
massimo(dot)costantini(at)gmail(dot)com> wrote:

>
> Hi,
>
> I have a problem with Triggers on VIEW:
>
> suppose I have:
>
> CREATE TABLE work (
> id integer NOT NULL,
> work TEXT,
> worktype TEXT
> );
>
> CREATE VIEW worksub AS SELECT FROM work WHERE worktype='subordinate';
>
>
> CREATE OR REPLACE FUNCTION wrk_view() RETURNS TRIGGER AS $wrk_tg$
> BEGIN
> RAISE NOTICE 'UPDATE VIEW FROM: % OPERATION: %',TG_TABLE_NAME,
> TG_OP;
> END;
> $wrk_tg$ LANGUAGE plpgsql;
>
> CREATE TRIGGER wrk_tg INSTEAD OF INSERT OR DELETE OR UPDATE ON worksub
> FOR EACH ROW EXECUTE PROCEDURE wrk_view();
>
> nothing appen when I insert row in work table.
>
> Someone can help me?
>
>

--

*
*
Beena Emerson

In response to

Browse pgeu-general by date

  From Date Subject
Next Message Massimo Costantini 2013-07-30 13:01:26 Re: Fwd: Trigger on VIEW not firing
Previous Message Ian Lawrence Barwick 2013-07-30 12:49:58 Re: Fwd: Trigger on VIEW not firing

Browse pgsql-general by date

  From Date Subject
Next Message Massimo Costantini 2013-07-30 13:01:26 Re: Fwd: Trigger on VIEW not firing
Previous Message Ian Lawrence Barwick 2013-07-30 12:49:58 Re: Fwd: Trigger on VIEW not firing