Re: partitioning and identity column
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-11-13T10:21:43Z
Lists: pgsql-hackers
On 27.10.23 13:32, Ashutosh Bapat wrote: > I think we should fix these anomalies as follows > 1. Allow identity columns to be added to the partitioned table > irrespective of whether they have partitions of not. > 2. Propagate identity property to partitions. > 3. Use the same underlying sequence for getting default value of an > identity column when INSERTing directly in a partition. > 4. Disallow attaching a partition with identity column. > > 1 will fix inconsistencies in Behaviour 3 and 4. 2 and 3 will fix > anomalies in Behaviour 1. 4 will fix Behaviour 2. This makes sense to me. Note, here is a writeup about the behavior of generated columns with partitioning: https://www.postgresql.org/docs/devel/ddl-generated-columns.html. It would be useful if we documented the behavior of identity columns similarly. (I'm not saying the behavior has to match.) One thing that's not clear to me is what should happen if you have a partitioned table with an identity column and you try to attach a partition that has its own identity definition for that column. I suppose we shouldn't allow that. (The equivalent case for generated columns is allowed.)
Commits
-
Fix assorted bugs related to identity column in partitioned tables
- 509199587df7 17.0 landed
-
Remove extra check_stack_depth() from dropconstraint_internal()
- 75bcba6cbd2a 17.0 landed
-
Support identity columns in partitioned tables
- 699586315704 17.0 landed
-
doc: Add Identity Column section under Data Definition chapter
- a37bb7c13995 17.0 landed
-
Assert that partition inherits from only one parent in MergeAttributes()
- d22d98c34171 17.0 landed
-
doc: Decorate PostgreSQL with productname tag
- 58b20e6d75e5 17.0 landed
-
Fix prologue of get_partition_ancestors()
- e557db106ef6 17.0 landed