Re: Fwd: Problem with a "complex" upsert

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Mario De Frutos Dieguez <mariodefrutos(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Fwd: Problem with a "complex" upsert
Date: 2018-08-03 09:40:50
Message-ID: CAEZATCUzdUerONYpaZ-YTVKOyzm1B-Ya9XzFXoMs0yrwJr0hkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-bugs

On 3 August 2018 at 07:52, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> This doesn't look right to me. It breaks the following case ...

Here's an updated patch that fixes this.

> I also don't see why it should reject columns from the view that
> aren't in the base relation.

This patch also allows access to view columns that aren't in the
underlying base relation. The rationale for the result in the new test
case where it attempts to insert (1,'y') into columns (aa,bb) of the
view is that the new view row that would have resulted if the insert
had succeeded is ('y',1,(1,'y')), hence that's what excluded.* should
be for the view in the "on conflict" action, and there should be no
problem referring to any part of that excluded view tuple.

Regards,
Dean

Attachment Content-Type Size
insert-on-conflict-on-updatable-view-v3.patch text/x-patch 14.7 KB

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Amit Langote 2018-08-03 10:17:05 Re: Fwd: Problem with a "complex" upsert
Previous Message Fabio Pardi 2018-08-03 08:25:21 Re: Optimal SSD based RAID 0 config

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Langote 2018-08-03 10:17:05 Re: Fwd: Problem with a "complex" upsert
Previous Message 周正中 (德歌) 2018-08-03 08:16:21 回复:how to enable pgcrypto