Re: Re: (expert) "insert into VIEW returning" inside an instead of trigger returns nothing - Mailing list pgsql-general

From Willy-Bas Loos
Subject Re: Re: (expert) "insert into VIEW returning" inside an instead of trigger returns nothing
Date
Msg-id CAHnozTg6M5OoNcS9i9ciXWY2_zE=7SV7G=kY+_cJnJTM8BfZhQ@mail.gmail.com
Whole thread Raw
In response to Re: (expert) "insert into VIEW returning" inside an instead of trigger returns nothing  (Rémi Cura <remi.cura@gmail.com>)
List pgsql-general
On Wed, Sep 2, 2015 at 2:16 PM, Rémi Cura <remi.cura@gmail.com> wrote:
I think I got it,
I have to always return something (like NEW) in the instead of trigger,
but fill NEW
with returnings of INSERT into regular table.


Yes, the GID is detemined for the table.
But in test.rc_editing_generic_object(  ) you are reurning the NEW that you just inserted from test.rc_editing_specific_object(  ).
The gid is filled for the table, but since you are doing an INSERT on the table INSTEAD of the one that came in, the gid is not filled. The view does not read from the table in this case, but writes, so the gid is not yet available in NEW.

Cheers,

Willy-Bas

pgsql-general by date:

Previous
From: Andres Freund
Date:
Subject: Re: FDW and BDR
Next
From: Willy-Bas Loos
Date:
Subject: Re: FDW and BDR