Re: partitioning and identity column

Alexander Law <exclusion@gmail.com>

From: Alexander Lakhin <exclusion@gmail.com>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-04-27T15:00:01Z
Lists: pgsql-hackers
Hello Ashutosh,

26.04.2024 21:00, Alexander Lakhin wrote:
> 26.04.2024 15:57, Ashutosh Bapat wrote:
>> Thanks Alexander for the report.
>>
>> On Fri, Apr 26, 2024 at 5:30 PM Alexander Lakhin <exclusion@gmail.com> wrote:
>>
>>
>>     CREATE TABLE tbl3 (LIKE tbl2 INCLUDING IDENTITY);
>>     ERROR:  no owned sequence found
>>
>>
>
>>
>> Do you want to track this in open items?
>>
>
> If you are inclined to fix this behavior,  I would add this item.


Please look also at another script, which produces the same error:
CREATE TABLE tbl1 (a int GENERATED BY DEFAULT AS IDENTITY, b text)
    PARTITION BY LIST (b);
CREATE TABLE tbl2 PARTITION OF tbl1 DEFAULT;

ALTER TABLE tbl1 ALTER COLUMN a SET DATA TYPE bigint;
ERROR:  no owned sequence found

(On 699586315~1, it executes successfully and changes the data type of the
identity column and it's sequence.)

Best regards,
Alexander

Commits

  1. Fix assorted bugs related to identity column in partitioned tables

  2. Remove extra check_stack_depth() from dropconstraint_internal()

  3. Support identity columns in partitioned tables

  4. doc: Add Identity Column section under Data Definition chapter

  5. Assert that partition inherits from only one parent in MergeAttributes()

  6. doc: Decorate PostgreSQL with productname tag

  7. Fix prologue of get_partition_ancestors()