Re: CREATE TABLE ... LIKE INCLUDING ALL does not create new sequences for serial columns

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Kumaresan Balakrishnan <kumaresan(dot)balakrishnan(at)intics(dot)ai>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Cc: Janarthanan Poornavel <jana(at)intics(dot)ai>, Sivadhas arumugam <sivadhas(dot)arumugam(at)intics(dot)ai>, Intics Devops <intics(dot)devops(at)intics(dot)ai>
Subject: Re: CREATE TABLE ... LIKE INCLUDING ALL does not create new sequences for serial columns
Date: 2025-11-05 13:01:16
Message-ID: eaf5d324-713f-4075-970b-989c5edea00a@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 03.11.25 18:10, Kumaresan Balakrishnan wrote:
> This behavior occurs even with `INCLUDING ALL`, which implies `INCLUDING
> DEFAULTS`
> and `INCLUDING IDENTITY`.  However, it seems that when serial columns
> are used,
> their associated sequences are copied by reference rather than duplicated.

This works correctly if you use GENERATED ALWAYS AS IDENTITY instead of
serial.

Using serial is kind of deprecated for reasons like this.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-11-05 14:49:56 Re: BUG #19104: Does regexp_substr function support non-greedy matching?
Previous Message PG Bug reporting form 2025-11-05 12:41:30 BUG #19104: Does regexp_substr function support non-greedy matching?