From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Andy S <gatekeeper(dot)mail(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition |
Date: | 2020-11-14 01:26:02 |
Message-ID: | CAKFQuwa+J=o+0soizRjr087uJPAPr2kE9fUjK4NQk=kc1nESCQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Fri, Nov 13, 2020 at 11:40 AM Andy S <gatekeeper(dot)mail(at)gmail(dot)com> wrote:
> This works as intended but: the exact index raised was not the one
> inferred since the top-level partition itself is not a default partition
> hence always empty hence it's index is always empty; an empty index cannot
> raise uniqueness violation exceptions then the one raised must be the leaf
> partition's (whichever it is).
>
There seems to be a mix-up regarding the uniqueness restriction (a
constraint) and the way it is implemented (unique indexes, wherever they
may exist). That might be partly the documentation's fault for using index
in improper places but I haven't fully checked that out. In any case, the
unique constraint on the partitioned table can very well be enforced even
if that named relation doesn't actually have data nor a backing unique
index. The point of the partitioned table is to abstract that away from
the user.
It would be nice if the ON CONFLICT behavior could be abstracted away as
well, and you are right in your expectation that it would. But it is not a
bug that our implementation is lacking in that area, though it could maybe
be better documented, as evidenced by this thread.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Abhijith Balan | 2020-11-14 01:37:39 | Data format mismatch between minor versions |
Previous Message | David G. Johnston | 2020-11-14 01:14:21 | Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition |