Re: Duplicate unique key values in inheritance tables

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Duplicate unique key values in inheritance tables
Дата
Msg-id CAApHDvo9LJN8PpOzfh5FBy_PVX5e=NzBKceOYRy-Zh7=8KZY3A@mail.gmail.com
обсуждение исходный текст
Ответ на Duplicate unique key values in inheritance tables  (Richard Guo <guofenglinux@gmail.com>)
Ответы Re: Duplicate unique key values in inheritance tables
Список pgsql-hackers
On Tue, 16 Jul 2024 at 12:45, Richard Guo <guofenglinux@gmail.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.  Maybe something like below.
>
> @@ -1421,7 +1427,9 @@ check_ungrouped_columns_walker(Node *node,
>         Assert(var->varno > 0 &&
>                (int) var->varno <= list_length(context->pstate->p_rtable));
>         rte = rt_fetch(var->varno, context->pstate->p_rtable);
> -       if (rte->rtekind == RTE_RELATION)
> +       if (rte->rtekind == RTE_RELATION &&
> +           !(rte->relkind == RELKIND_RELATION &&
> +             rte->inh && has_subclass(rte->relid)))
>         {
>             if (check_functional_grouping(rte->relid,
>
> Any thoughts?

The problem with doing that is that it might mean queries that used to
work no longer work.  CREATE VIEW could also fail where it used to
work which could render pg_dumps unrestorable.

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.

David



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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Injection point locking
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Allow non-superuser to cancel superuser tasks.