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 06:52:38
Message-ID: CAEZATCWqLba_VVT1cdaT3YOijESRT8qewLN93Oc7H7ikW2fd-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-bugs

On 2 August 2018 at 11:38, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> Attaching the updated patch, which is quite heavily revised from the
> earlier patch, given the above findings.
>

This doesn't look right to me. It breaks the following case which
currently works in HEAD:

--
drop table if exists foo cascade;
create table foo (a int unique, b text);
create view foo_view as select a as aa, b as bb from foo;

insert into foo_view (aa,bb) values (1,'x');
insert into foo_view (aa,bb) values (1,'y')
on conflict (aa) do update set bb = excluded.bb;
select * from foo_view;
--

I also don't see why it should reject columns from the view that
aren't in the base relation. Such columns need to remain unchanged in
the UPDATE because they're non-updatable, but they're still logically
part of the new excluded view tuple, and so it may still be useful to
refer to them in other parts of the auxiliary UPDATE.

Regards,
Dean

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2018-08-03 07:28:08 Re: PostgreSQL 9.3 - reindex problem
Previous Message Debraj Manna 2018-08-03 06:37:35 Re: Postgres 10 disk space requirement compared to postgres 9.5.4

Browse pgsql-bugs by date

  From Date Subject
Next Message Ze Victor Harry 2018-08-03 08:14:25 how to enable pgcrypto
Previous Message Andres Freund 2018-08-02 20:05:37 Re: could not read block 0 in file : read only 0 of 8192 bytes when doing nasty on immutable index function