Re: Remove mention in docs that foreign keys on partitioned tablesare not supported

Поиск
Список
Период
Сортировка
От Ashutosh Bapat
Тема Re: Remove mention in docs that foreign keys on partitioned tablesare not supported
Дата
Msg-id CAFjFpRdDNiec1PiQOa1Dt6SmZAaucGmSYH9V-m6ABEhEHRGwCA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Remove mention in docs that foreign keys on partitioned tablesare not supported  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Ответы Re: Remove mention in docs that foreign keys on partitioned tablesare not supported  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Re: Remove mention in docs that foreign keys on partitioned tablesare not supported  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Fri, Jun 29, 2018 at 6:35 PM, Tomas Vondra
<tomas.vondra@2ndquadrant.com> wrote:
>
>
> On 06/29/2018 02:30 PM, Robert Haas wrote:
>>
>> On Wed, Jun 27, 2018 at 10:26 PM, Amit Langote
>> <Langote_Amit_f8@lab.ntt.co.jp> wrote:
>>>
>>> By the way, picking up on the word "inherited" in the error message shown
>>> above, I wonder if you decided against using similar terminology
>>> intentionally.
>>
>>
>> Good question.
>>
>>> I guess the thinking there is that the terminology being
>>> used extensively with columns and constraints ("inherited column/check
>>> constraint cannot be dropped", etc.) is just a legacy of partitioning
>>> sharing implementation with inheritance.
>>
>>
>> It seems to me that we can talk about things being inherited by
>> partitions even if we're calling the feature partitioning, rather than
>> inheritance.  Maybe that's confusing, but then again, maybe it's not
>> that confusing.
>>
>
> my 2c: I don't think it's confusing. Inheritance is a generic concept, not
> attached exclusively to the "table inheritance". If you look at docs from
> other databases, you'll see "partition inherits" all the time.

I generally agree with this. But I think we need to think more in the
context of the particular example Amit gave.

-- quoting Amit's example,

               Table "public.p1"
 Column |  Type   | Collation | Nullable | Default
--------+---------+-----------+----------+---------
 a      | integer |           |          |
 b      | integer |           |          |
Partition of: p FOR VALUES IN (1)
Check constraints:
    "p1_b_check" CHECK (b >= 0)
    "p_a_check" CHECK (a >= 0)

alter table p1 drop constraint p_a_check;
ERROR:  cannot drop inherited constraint "p_a_check" of relation "p1"

--unquote

This constraint was added to the partitioned table and inherited from
there. If user wants to drop that constraint for some reason, this
error message doesn't help. The error message tells why he can't drop
it, but doesn't tell, directly or indirectly, the user what he should
do in order to drop it. When there was only a single way, i.e table
inheritance, to "inherit" things users could probably guess that. But
now there are multiple ways to inherit things, we have to help user a
bit more. The user might figure out that ti's a partition of a table,
so the constraint is inherited from the partitioned table. But it will
help if we give a hint about from where the constraint was inherited
like the error message itself reads like "can not drop constraint
"p_a_check" on relation "p1" inherited from "partitioned table's name"
OR a hint "you may drop constraint "p_a_check" on the partitioned
table "partitioned table's name". It might even suffice to say
"partition p1" instead "relation p1" so that the user gets a clue.

-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company


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

Предыдущее
От: Haribabu Kommi
Дата:
Сообщение: Re: New function pg_stat_statements_reset_query() to reset statisticsof a specific query
Следующее
От: "C,C H"
Дата:
Сообщение: Add a tab-completion for "SELECT INTO" or "SELECT FROM"in psql