Re: Re: (expert) "insert into VIEW returning" inside an instead of trigger returns nothing

From: Willy-Bas Loos <willybas(at)gmail(dot)com>
To: Rémi Cura <remi(dot)cura(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Re: (expert) "insert into VIEW returning" inside an instead of trigger returns nothing
Date: 2015-09-02 12:40:10
Message-ID: CAHnozTg6M5OoNcS9i9ciXWY2_zE=7SV7G=kY+_cJnJTM8BfZhQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Sep 2, 2015 at 2:16 PM, Rémi Cura <remi(dot)cura(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andres Freund 2015-09-02 12:40:11 Re: FDW and BDR
Previous Message Tom Lane 2015-09-02 12:34:07 Re: FDW and BDR