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

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Nagaraj Raj <nagaraj(dot)sf(at)yahoo(dot)com>, Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: ERROR: insufficient columns in the PRIMARY KEY constraint definition
Date: 2020-09-29 22:39:07
Message-ID: 20200929223907.GA14950@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2020-Sep-29, Tom Lane wrote:

> Indeed. However, this complaint shows that the error message is not clear
> enough. I propose changing it to
>
> ERROR: unique constraint on partitioned table must be a superset of the partitioning columns
>
> or perhaps
>
> ERROR: unique constraint on partitioned table must include all partitioning columns

Either of those work for me. How common is the word "superset" in
English? We don't seem seem to use it either in error messages, though
it does occur in docs.

> > 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
>
> Meh. If you've read that bit you probably already understand that
> pkeys are unique constraints. I think the problem is with the error
> text not the docs.

Maybe mention PKs in parens:

"Unique constraints (and[, by extension,] primary key 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

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-09-29 22:43:38 Re: ERROR: insufficient columns in the PRIMARY KEY constraint definition
Previous Message Tom Lane 2020-09-29 22:37:35 Re: ERROR: insufficient columns in the PRIMARY KEY constraint definition