From: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Simon Riggs <simon(at)2ndquadrant(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] INSERT ON CONFLICT and partitioned tables |
Date: | 2017-12-01 04:52:51 |
Message-ID: | a26f7823-6c7d-3f41-c5fb-7d50dd2f4848@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2017/12/01 11:27, Simon Riggs wrote:
> On 24 November 2017 at 13:45, Amit Langote
> <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>
>>> Why? There is no caller that needs information.
>>
>> It is to be used if and when ExecInsert() calls
>> ExecCheckIndexConstraints() in the code path to handle ON CONFLICT DO
>> NOTHING that we're intending to support in some cases. Note that it will
>> only check conflicts for the individual leaf partitions using whatever
>> constraint-enforcing indexes they might have.
>
> So we should have 2 patches. One for now that does DO NOTHING and
> another that adds the change that depends upon Alvaro's work.
Yes, I'd think so.
It won't be until the patch at [1] to add support to define UNIQUE indexes
on partitioned tables is committed that we could support specifying
conflict_target on partitioned tables. Even then, it would take at least
some executor changes to actually make it work, but at least the planner
won't complain that there are no indexes. If I try Alvaro's patch today
and see what happens when conflict_target is specified, still get an error
but now it's the executor:
create table p (a int, b char) partition by list (a);
create table p1 partition of p (b unique) for values in (1);
-- on HEAD (before applying the patch on this thread)
insert into p values (1) on conflict (a) do nothing;
ERROR: ON CONFLICT clause is not supported with partitioned tables
-- after applying the patch on this thread (no indexes yet)
insert into p values (1) on conflict (a) do nothing;
ERROR: there is no unique or exclusion constraint matching the ON
CONFLICT specification
-- after applying Alvaro's patch at [1]
create unique index on p (a);
-- but, the executor support is missing, so...
insert into p values (1) on conflict (a) do nothing;
ERROR: unexpected failure to find arbiter index
I will report this on that thread and we can discuss the executor changes
that would be need to make it work there.
Thanks,
Amit
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2017-12-01 04:54:56 | Re: Use of uninitialized variables in ExecFindPartition() for parent partition without leaves (HEAD only) |
Previous Message | David Rowley | 2017-12-01 04:39:10 | Re: [HACKERS] Proposal: Local indexes for partitioned table |