Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition
Дата
Msg-id 20201114002805.5s26gg3hliywrath@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition  (Andy S <gatekeeper.mail@gmail.com>)
Ответы Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition  (Andy S <gatekeeper.mail@gmail.com>)
Список pgsql-bugs
Hi,

On 2020-11-13 21:30:39 +0300, Andy S wrote:
> No, it's a bug

At best it is a potentially desirable feature. One that isn't trivial to
implement. We'd have to scan the entire partition tree to ensure there's
a matching constraint on all partitions. And add some more complicated
way to do plan invalidation, because somebody could add a new partition
without a matching constraint - which'd not be detected in a trivial
implementation, because the arbiter determination happens at parse
analysis time.


> Also:
> the certain partition to which data is to be inserted is computed at query
> planning stage the very stage where the planner could also find out if an
> index matching the given specification could be inferred since it's the
> only index that matters.

That is not generally the case. You can have parametrized values that
are inserted, and you can have multi-row inserts. In both cases you
cannot make this decision at plan time.

- Andres



В списке pgsql-bugs по дате отправления:

Предыдущее
От: Ernesto Hernández-Novich
Дата:
Сообщение: Re: PG 9.6.20 -- query misbehaves in replica
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition