From: | Philipp Kraus <philipp(dot)kraus(at)flashpixx(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: acessibility for tables |
Date: | 2012-06-07 20:20:16 |
Message-ID: | jqr29d$ifr$1@dough.gmane.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I have recreated the view and the trigger function, now it works. I
don't know why it does not run on my first try.
My functions shows now:
BEGIN
IF TG_OP = 'INSERT' then
insert into mytargettable values NEW;
ELSIF TG_OP = 'UPDATE' then
raise notice 'UPDATE trigger, OLD = [%], NEW = [%]', OLD, NEW;
ELSE
raise notice 'DELETE trigger, OLD = [%]', OLD;
END IF;
raise exception 'trigger uncomplete ended';
END;
Is this a correct structure, so that each trigger-typ must be run a SQL
statement?
Can I pass the NEW and OLD argument to the original table eg insert
into mytargettable values NEW,
or update mytargettable from NEW?
Thanks
Phil
On 2012-06-07 10:55:48 +0200, Willy-Bas Loos said:
> the error sounds clear enough.
> you should make a very simple test case that shows your problem
> (including some test data).
> then people on the list can help
>
> cheers,
>
> WBL
>
> On Thu, Jun 7, 2012 at 1:59 AM, Philipp Kraus
> <philipp(dot)kraus(at)flashpixx(dot)de> wrote:
> Hello,
>
>
> On 2012-06-06 09:24:16 +0200, Albe Laurenz said:
>
> You can define INSTEAD OF triggers on a view so that you can insert,
> update and delete on it. The trigger performs an operation on the
> base table instead.
>
> I have created the trigger with "insead of". If I try to insert a row into the
> view I get an error:
>
> You need an unconditional ON INSERT DO INSTEAD rule or an INSTEAD OF
> INSERT trigger
>
> Should I create a rule !?
>
> Thanks
>
> Phil
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
>
>
> --
> "Quality comes from focus and clarity of purpose" -- Mark Shuttleworth
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2012-06-07 20:48:35 | Re: Problem while restoring a database from SQL_ASCII to UTF-8 |
Previous Message | Adrian Klaver | 2012-06-07 20:14:53 | Re: Need help in transferring FP to Int64 DateTime |