Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vGBhq-009aGP-Rk for pgsql-bugs@arkaria.postgresql.org; Tue, 04 Nov 2025 07:43:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vGBgr-00BnVN-5i for pgsql-bugs@arkaria.postgresql.org; Tue, 04 Nov 2025 07:42:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vG0WK-008ijh-4X for pgsql-bugs@lists.postgresql.org; Mon, 03 Nov 2025 19:47:15 +0000 Received: from mail-southindiaazon11021123.outbound.protection.outlook.com ([40.107.57.123] helo=MA0PR01CU012.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vG0WG-005nn3-1m for pgsql-bugs@lists.postgresql.org; Mon, 03 Nov 2025 19:47:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZPhqkBpjvWO0klPlKlTTifupX85p43pe3Pr8H7JxXFdt7NPjIYyKpmWYgLVb2QVyElvfx9wWKGgrODL59MPGGdUdjw82kE+fACNpqEcD34X2Cnk3RbYtxUkxZISnjZJMdm8Q7wSooYP3VvkB04NQkytPQfE5XzUXyKIus3Q7jxA9QgBlcB9lO8RKCu8NfDwK2z9CKnNsfTQUOH6CG6aFwOQ1PqPanf5s7eTSipXIlM8Z77xYGvGhtdu0IOeH4ZKxGzhiLKueidK7uZhpfZxGSz1HHslJ1jPKspdC/3re3gT/jL3OeR4SlDQ9QxTIlXa31cUbz9QshQnoB/a7dObxFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Zq4ouNQiJH6m1Dr/EvLBSODVlGju4D+ZSU4pGGgFE2U=; b=Jcn2fAyUO5QDXn6WjCqcE4VloUM3LdRFXhioYQJrqhR/izYOaXBz8OPFJwB1OOdpyiQT/f+QcjJ4dRUdNyDWdLUP/cBNiOiSZQtLvIGsQXULh/6H+OK03yIVS6vV71Kd5xmwVnChdMGWKy3nx8dmzcimEkNQq42QYuEZKe/XUHRblbf5ZRF0LOeZ1gfnZBz3KuIdy1STKzg1A1xGbzDSoDAPO0loZxXKrJo+We/HJK6IGtupkWzr+jg1dZQ8N5iflOKrnfY5m3BPbjqOXOHWBG1ht27dhSiqoBPWAtnJD9XcajF3cD4RGzGEpIW8Pl+/TziFLKLcWQB4OkXPVMB3RA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intics.ai; dmarc=pass action=none header.from=intics.ai; dkim=pass header.d=intics.ai; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intics.ai; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zq4ouNQiJH6m1Dr/EvLBSODVlGju4D+ZSU4pGGgFE2U=; b=aNxUcyPMF1SvFdZ9jpwhpjFpLy3V+U04PoOqNVBQ1ro3D3VuvISdnDKlCSIf415EmtmbwarFNetXXfllSCfNG0XNY+/L5Zq1T/SBXVL0Qn8k0MXRqm1kkJ0vO6PgROWcRdymJh0vowNFygVIMjkrc3NaY81VF9dy6eyR+nCmUdIZTcagJZlUBqhgLwpurWJ6OEUvkHVI7cV1ksygdTRXPGN9ug2rhUhFEeY1OWLFF8U8ryGXPNAHvV4++PCs2wUKuJj29i0loexDaI5NzzSXc2ekbVoxMcRkjNhz/yPCP9yEAl8iwpDNWeabKk5lvpZNx2MSTGXkazl8qUxu+gW9Mw== Received: from MA0PR01MB8986.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:119::8) by PN1PPFCF965E3F2.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c04:1::42f) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9275.16; Mon, 3 Nov 2025 19:47:05 +0000 Received: from MA0PR01MB8986.INDPRD01.PROD.OUTLOOK.COM ([fe80::8b51:85b:3e64:2cdb]) by MA0PR01MB8986.INDPRD01.PROD.OUTLOOK.COM ([fe80::8b51:85b:3e64:2cdb%3]) with mapi id 15.20.9275.015; Mon, 3 Nov 2025 19:47:05 +0000 From: Sivadhas arumugam To: Kumaresan Balakrishnan , "pgsql-bugs@lists.postgresql.org" CC: Janarthanan Poornavel , Intics Devops Subject: RE: CREATE TABLE ... LIKE INCLUDING ALL does not create new sequences for serial columns Thread-Topic: CREATE TABLE ... LIKE INCLUDING ALL does not create new sequences for serial columns Thread-Index: AQHcTOKZcwpqmhsNRUq+aBwxnNtnp7ThW01g Date: Mon, 3 Nov 2025 19:47:05 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intics.ai; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MA0PR01MB8986:EE_|PN1PPFCF965E3F2:EE_ x-ms-office365-filtering-correlation-id: d933e01b-b7cf-4619-7266-08de1b11c46d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|376014|1800799024|10070799003|366016|38070700021|8096899003|7053199007; x-microsoft-antispam-message-info: =?us-ascii?Q?DfoE6HCAhQ6/CH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NJkE?= =?us-ascii?Q?OMH7JPjKbiAf65uxniRZddKC7R46ah+EV6M1tavbW5Meb7Y1XpN2JwfqPfHP?= =?us-ascii?Q?4ewTnb6xKsfMvK2QL2uoCQ4yoWzkfu1wCueE7Vy7l22ct7fhjj3V8DZrSZrR?= =?us-ascii?Q?pKWZwIJcAxe5k4uvsXIZaUr25kzI8x3SFmonvrMXrRPKnrasl5qKE2dokLzd?= =?us-ascii?Q?uI0VVWvfgf8lbCDehr1RI9hoXlP+wOGLEe3YVAQilXshTnaTgPVPxEZqCk6n?= =?us-ascii?Q?flZRtxVaaxwVJMvbD11HH0Rkab7CrsE79eU96dJMK/VSUjc3fTJbZJrQ6407?= =?us-ascii?Q?2BlNuMjTaitzCBGPYQAlqo6JxJbXyFgsDtYaffIjA4KqEseUPhPvD5bKOg5w?= =?us-ascii?Q?e8g5SM6zgyMF9Yss2sH+LZNwTT9mePbp2NHUcru3F6gG+e9FFztCl0F3CVaH?= =?us-ascii?Q?kcVwG3lULF2fBwrsvgFnhkon11sveNUWF9o6PLdqlClTZyBPdutqsn0WYleN?= =?us-ascii?Q?vtaPMd4eWVEPudugV5D+BTLYBwJMRnQMDPoh/9/YOkU/kTnpUMlo0pPFOLXG?= =?us-ascii?Q?IuhMsuvlp6Z/xWPYuwMP5r+6dekuX0Bk/GcrMZY8VwWfuyN1teJXqRbkuNRq?= =?us-ascii?Q?Mo9eNoYO3hVwha4mcUf/Czxlc4MSINN37lD/?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MA0PR01MB8986.INDPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(10070799003)(366016)(38070700021)(8096899003)(7053199007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ENfLO1EoCv4kmh+qlmiSDbNUO5SIrp+cNHQ4yP7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?2DMHL+ep0cxBQA27SkgGdqO+iM6tqokrP3C9iP0AANV2mZKsFYqME7QirHVp?= =?us-ascii?Q?0W70A0A0JGKcDPD8o82rKt2W87xCicHa5SZNJLewo1j160P831xjA86bTozd?= =?us-ascii?Q?wjSw/7UjRsjl7IQX6AguK2o0tDanD+02DrBIPZF6T5u5LMY8HKrA/2ZOoqQa?= =?us-ascii?Q?t8F2taM+UVy20yifelKX5HB3tp9xZgQJICkkoKxM7X7Xdk4w1bicV/ICDu/r?= =?us-ascii?Q?p7ul1rvNpDGoYEXvA/9GkKWNyZH7FxHHkd0ekA2G8gF3qxWxCIeramE/pbHX?= =?us-ascii?Q?89Sju58SC6ipKzEApREiqmbVQ8NBG7gj51pzDTMlbN6C0nI11nujj1ojOa+j?= =?us-ascii?Q?BBGnXjxw/l55lRavuA+KRbSfhw6zOPBeNjDy0dtKSF6v+z2HFpI6jMy0KYmS?= =?us-ascii?Q?o954UY38g6bvJVwqym/qtj/Wp+/E+tnID4CTnTRTGUNoV4LbHxvbYwVngn3z?= =?us-ascii?Q?9S/Ngpg4eoJghVQ6V+l3DXQ9t3b/C8oZSpLap+UbOKlpUNMFZrk9sGl5Ml69?= =?us-ascii?Q?Ng9qG4vzKEdWVIEQkVrr13vm1F+zLjorxqcUTHWnOM7BpfzXyUPgguJx9m4Z?= =?us-ascii?Q?LHMOChnexTh+jOawK2ld+DDdG2HsaBmdQkfWTlcfuUyTkzO61oy8Kzh8FaLt?= =?us-ascii?Q?foxy49pH6p500Ewz0eMnZN+3wHXPn0o8v3PnpOrX1DT9cmm6EGW1Hmuf/6x1?= =?us-ascii?Q?gpWs2op8J7zpx7qGKkXRVU6PblPQe4RcJJ5NcbxOtm6FAgKcXoDG0Ua1FboV?= =?us-ascii?Q?sUOFGw=3D=3D?= Content-Type: multipart/alternative; boundary="_000_MA0PR01MB8986D09840FAB4756C4ED420FEC7AMA0PR01MB8986INDP_" MIME-Version: 1.0 X-OriginatorOrg: intics.ai X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MA0PR01MB8986.INDPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: d933e01b-b7cf-4619-7266-08de1b11c46d X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Nov 2025 19:47:05.6685 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f609f5e5-b221-43f3-be25-48bb8ce0552e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: uKEZm+K3YrDWVahB33+SwH6sNpBChf5qGdZGcsKSyNkdMtbElNBm5Hlb+QSlOkwTVcNchKNIP+LPIwbwwb1dK5GkU6W6kFLGkhncp/ngos4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN1PPFCF965E3F2 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_MA0PR01MB8986D09840FAB4756C4ED420FEC7AMA0PR01MB8986INDP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable FYI - We tried logging in the issue through their JIRA which we weren't abl= e to do. So, we have taken this route so far to at-least close the loop thi= s way. We will keep you posted on next developments as we get more details. Best regards Sivadhas A From: Kumaresan Balakrishnan Sent: 03 November 2025 22:40 To: pgsql-bugs@lists.postgresql.org Cc: Janarthanan Poornavel ; Sivadhas arumugam ; Intics Devops Subject: CREATE TABLE ... LIKE INCLUDING ALL does not create new sequences = for serial columns Dear PostgreSQL team, I encountered an unexpected behavior when using the "CREATE TABLE ... LIKE = ... INCLUDING ALL" syntax. When a table is created this way from another table that contains serial or= identity columns, the new table's column defaults still reference the *original* sequence obj= ects from the source table, rather than creating new independent sequences. This results in both tables sharing the same sequence, which can cause data= consistency issues if inserts happen on both tables. ### Steps to reproduce Tested on PostgreSQL 16.1 (Ubuntu 22.04, x86_64). 1. Create a base table: CREATE SCHEMA IF NOT EXISTS audit; CREATE TABLE audit.statement_execution_audit ( id serial PRIMARY KEY, description text ); 2. Backup and recreate the table: DROP TABLE IF EXISTS audit.statement_execution_audit_backup; ALTER TABLE audit.statement_execution_audit RENAME TO statement_execution_audit_backup; CREATE TABLE audit.statement_execution_audit (LIKE audit.statement_execution_audit_backup INCLUDING ALL); 3. Inspect defaults: \d audit.statement_execution_audit ### Observed behavior The `id` column of the newly created table references the same sequence: nextval('audit.statement_execution_audit_backup_id_seq'::regclass) ### Expected behavior Ideally, the new table should receive its *own sequence* (for example, `audit.statement_execution_audit_id_seq`), or there should be an option suc= h as `INCLUDING SEQUENCES` to explicitly request new sequence creation. ### Notes This behavior occurs even with `INCLUDING ALL`, which implies `INCLUDING DE= FAULTS` and `INCLUDING IDENTITY`. However, it seems that when serial columns are u= sed, their associated sequences are copied by reference rather than duplicated. If this is expected behavior, perhaps documentation could clarify that `INCLUDING ALL` does not create new sequences for serial columns. Thank you for your time and all your work maintaining PostgreSQL. Regards, Kumareasan --_000_MA0PR01MB8986D09840FAB4756C4ED420FEC7AMA0PR01MB8986INDP_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

FYI - We tried logging i= n the issue through their JIRA which we weren't able to do. So, we have tak= en this route so far to at-least close the loop this way. We will keep you posted on next developments as we get more deta= ils.

 =

Bes= t regards

Siv= adhas A

 =

From: = Kumaresan Balakrishnan <kumaresan.balakrishnan@intics.ai>
Sent: 03 November 2025 22:40
To: pgsql-bugs@lists.postgresql.org
Cc: Janarthanan Poornavel <jana@intics.ai>; Sivadhas arumugam = <sivadhas.arumugam@intics.ai>; Intics Devops <intics.devops@intics= .ai>
Subject: CREATE TABLE ... LIKE INCLUDING ALL does not create new seq= uences for serial columns

 

Dear PostgreSQL team,

 =

I encountered an unexpec= ted behavior when using the "CREATE TABLE ... LIKE ... INCLUDING ALL&q= uot; syntax.

 =

When a table is created = this way from another table that contains serial or identity columns,<= /o:p>

the new table’s co= lumn defaults still reference the *original* sequence objects from the sour= ce table,

rather than creating new= independent sequences.

 =

This results in both tab= les sharing the same sequence, which can cause data consistency issues=

if inserts happen on bot= h tables.

 =

### Steps to reproduce

 =

Tested on PostgreSQL 16.= 1 (Ubuntu 22.04, x86_64).

 =

1. Create a base table:<= o:p>

   CREATE SCHE= MA IF NOT EXISTS audit;

   CREATE TABL= E audit.statement_execution_audit (

      &nb= sp;id serial PRIMARY KEY,

      &nb= sp;description text

   );

 =

2. Backup and recreate t= he table:

   DROP TABLE = IF EXISTS audit.statement_execution_audit_backup;

   ALTER TABLE= audit.statement_execution_audit

     RENA= ME TO statement_execution_audit_backup;

 =

   CREATE TABL= E audit.statement_execution_audit

     (LIK= E audit.statement_execution_audit_backup INCLUDING ALL);<= /p>

 =

3. Inspect defaults:

   \d audit.st= atement_execution_audit

 =

### Observed behavior

 =

The `id` column of the n= ewly created table references the same sequence:

  nextval('audit.st= atement_execution_audit_backup_id_seq'::regclass)

 =

### Expected behavior

 =

Ideally, the new table s= hould receive its *own sequence* (for example,

`audit.statement_executi= on_audit_id_seq`), or there should be an option such as

`INCLUDING SEQUENCES` to= explicitly request new sequence creation.

 =

### Notes

 =

This behavior occurs eve= n with `INCLUDING ALL`, which implies `INCLUDING DEFAULTS`

and `INCLUDING IDENTITY`= .  However, it seems that when serial columns are used,

their associated sequenc= es are copied by reference rather than duplicated.

 =

If this is expected beha= vior, perhaps documentation could clarify that

`INCLUDING ALL` does not= create new sequences for serial columns.

 =

Thank you for your time = and all your work maintaining PostgreSQL.

 =

Regards,

Kumareasan

 =

 

--_000_MA0PR01MB8986D09840FAB4756C4ED420FEC7AMA0PR01MB8986INDP_--