BUG #18645: Change between 16 and 17 when attaching partitions and the root tbl has identity col - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18645: Change between 16 and 17 when attaching partitions and the root tbl has identity col
Date
Msg-id 18645-d2e0249ab604d4f0@postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18645
Logged by:          nick j
Email address:      nick@innsenroute.com
PostgreSQL version: 17.0
Operating system:   win11
Description:

In v16, the following succeeded:

CREATE TABLE IF NOT EXISTS public.foo
(
    device_key uuid NOT NULL,
    message_created_date_time timestamp with time zone NOT NULL DEFAULT
CURRENT_TIMESTAMP,
    message_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1
START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 )  
) PARTITION BY LIST (device_key);

create table foo_1 (like foo including all);
alter table foo attach partition foo_1 for values in
('A1BBF163-6375-4C3D-8846-CDFABCBA7580');

create table foo_2 (like foo including all);
alter table foo attach partition foo_2 for values in
('B1BBF163-6375-4C3D-8846-CDFABCBA7580');

In v17, this throws the following exception:

ERROR: The new partition may not contain an identity column.table "foo_1"
being attached contains an identity column "message_id"

Switching to:  create table foo_2 (like foo including all excluding
identity); works.

This first surfaced when attempting to upgrade a v16 cluster to v17 via
pg_upgrade.


pgsql-bugs by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: BUG #18634: Wrong varnullingrels with merge ... when not matched by source
Next
From: Tom Lane
Date:
Subject: Re: BUG #18637: CREATE INDEX won't look up operator classes in search_path if PARTITION BY is specified