Re: Duplicate unique key values in inheritance tables

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Duplicate unique key values in inheritance tables
Date: 2024-07-16 01:28:54
Message-ID: CAKFQuwbOgnyaozbmvmq-V9Vi-B+7=_1Z9F8kwzSwfrSeRFMgFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Monday, July 15, 2024, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:

> On Tue, 16 Jul 2024 at 12:45, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> > As a workaround for this issue, I'm considering whether we can skip
> > checking functional dependency on primary keys for inheritance
> > parents, given that we cannot guarantee uniqueness on the keys in this
> > case.
>
> Because it's a parser issue, I don't think we can fix it the same way
> as a5be4062f was fixed.
>
> I don't have any ideas on what we can do about this right now, but
> thought it was worth sharing the above.
>

Add another note to caveats in the docs and call it a feature. We produce
a valid answer for the data model encountered. The non-determinism isn’t
wrong, it’s just a poorly written query/model with non-deterministic
results. Since v15 we have an any_value aggregate - we basically are
applying this to the dependent columns implicitly. A bit of revisionist
history but I’d rather do that than break said queries. Especially at
parse time; I’d be a bit more open to execution-time enforcement if
functional dependency on the id turns out to have actually been violated.
But people want, and in other products have, any_value implicit aggregation
in this situation so it’s hard to say it is wrong even if we otherwise take
the position that we will not accept it.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-07-16 01:32:01 Re: Internal error codes triggered by tests
Previous Message Michael Paquier 2024-07-16 01:27:25 Re: Pluggable cumulative statistics