Search Postgresql Archives

Re: Fwd: Trigger on VIEW not firing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.costantini@xxxxxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux