Re: Clarify restriction on partitioned tables primary key / unique indexes

2022-09-04 Thread David Rowley
On Fri, 2 Sept 2022 at 22:06, David Rowley  wrote:
> Thanks.  I ended up adjusting it to:
>
> "To create a unique or primary key constraint on a partitioned table,"

and pushed.

Thanks for having a look at this Erik.

David




Re: Clarify restriction on partitioned tables primary key / unique indexes

2022-09-02 Thread David Rowley
On Fri, 2 Sept 2022 at 22:01, Erik Rijkers  wrote:
> Minimal changes:
>
> 'To create a unique or primary key constraints on partitioned table'
>
> should be
>
> 'To create unique or primary key constraints on partitioned tables'

Thanks.  I ended up adjusting it to:

"To create a unique or primary key constraint on a partitioned table,"

David
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 3717d13fff..03c0193709 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -4174,12 +4174,13 @@ ALTER INDEX measurement_city_id_logdate_key
 
  
   
-   Unique constraints (and hence primary keys) on partitioned tables must
-   include all the partition key columns.  This limitation exists because
-   the individual indexes making up the constraint can only directly
-   enforce uniqueness within their own partitions; therefore, the
-   partition structure itself must guarantee that there are not
-   duplicates in different partitions.
+   To create a unique or primary key constraint on a partitioned table,
+   the partition keys must not include any expressions or function calls
+   and the constraint's columns must include all of the partition key
+   columns.  This limitation exists because the individual indexes making
+   up the constraint can only directly enforce uniqueness within their own
+   partitions; therefore, the partition structure itself must guarantee
+   that there are not duplicates in different partitions.
   
  
 


Re: Clarify restriction on partitioned tables primary key / unique indexes

2022-09-02 Thread Erik Rijkers



Op 02-09-2022 om 11:44 schreef David Rowley:

Over on [1], there was a question about why it wasn't possible to
create the following table:

CREATE TABLE foobar(
 id BIGINT NOT NULL PRIMARY KEY,
 baz VARCHAR NULL DEFAULT NULL
) PARTITION BY HASH(my_func(id));


The attached attempts to clarify these restrictions more accurately
based on the current code's restrictions.

If there's no objections or suggestions for better wording, I'd like
to commit the attached.


Minimal changes:

'To create a unique or primary key constraints on partitioned table'

should be

'To create unique or primary key constraints on partitioned tables'


Erik