Re: ERROR: insufficient columns in the PRIMARY KEY constraint definition

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: ERROR: insufficient columns in the PRIMARY KEY constraint definition
Дата
Msg-id CAApHDvrGCKVEQeJ0Tchxkq86NXvF=HzVoROv_jGAGYv61P8Tuw@mail.gmail.com
обсуждение исходный текст
Ответ на ERROR: insufficient columns in the PRIMARY KEY constraint definition  (Nagaraj Raj <nagaraj.sf@yahoo.com>)
Ответы Re: ERROR: insufficient columns in the PRIMARY KEY constraint definition  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Wed, 30 Sep 2020 at 10:36, Nagaraj Raj <nagaraj.sf@yahoo.com> wrote:
> Is it mandatory/necessary that the `partition column` should be a primary key? cause if I  include `load_dttm` as
`PK`then its working fine.
 

Yes, this is required.  There is no concept of an index over all
partitions in PostgreSQL.  The requirement of having the partition key
a subset of the primary key allows us to implement primary keys by
just having individual unique indexes on each partition.  The fact
that it does not work is not a bug.

There's mention in [1] section 5.10.2.3. "Unique constraints on
partitioned tables must include all the partition key columns. This
limitation exists because PostgreSQL can only enforce uniqueness in
each partition individually.". That text likely should also mention
PRIMARY KEY constraints. That probably should be changed

David

[1] https://www.postgresql.org/docs/11/ddl-partitioning.html



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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #16644: null value for defaults in OLD variable for trigger
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ERROR: insufficient columns in the PRIMARY KEY constraint definition