Re: BUG #19013: When creating a table with the "...LIKE...INCLUDING ALL" construct, REPLICA IDENTITY output is wrong

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "dbman(at)sqlexec(dot)com" <dbman(at)sqlexec(dot)com>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19013: When creating a table with the "...LIKE...INCLUDING ALL" construct, REPLICA IDENTITY output is wrong
Date: 2025-08-06 18:34:53
Message-ID: CAKFQuwYK1OS=vmJgbhyd7h2XD2axCHFeH4MhVEZRa_3B9F8uFg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Aug 6, 2025 at 8:42 AM dbman(at)sqlexec(dot)com <dbman(at)sqlexec(dot)com> wrote:

> thereby actually changing the state of the REPLICA IDENTITY from FULL or
> INDEX to DEFAULT.
>
Nothing is "changed". The newly created table never existed and as soon as
it did the value of replica identity was default. It was never anything
else.

Sure, maybe we should implement a LIKE option to cover replica identity,
but given that it doesn't exist the current behavior is valid - assign what
the value would be after a normal create table. I'd add maybe there should
be a way to specify replica identity during create table, not just alter
table, but that too is a new feature.

> It just seems that something should be done to prevent a change to the
> REPLICA IDENTIY if one exists that is not DEFAULT in the source table.
>
If you don't want the default, PK, replica identity on the new table you
are compelled to alter the table after you create it to specify what it
should be. Sure, we don't actually say those words, but since there is
nothing in create table that deals with replica identity, that is the
conclusion one must draw. We tend to only document affirmatives - I'm not
all that convinced this is going to be an exception.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2025-08-07 03:38:55 Re: TRAP: failed Assert("outerPlan != NULL") in postgres_fdw.c
Previous Message Álvaro Herrera 2025-08-06 18:04:37 Re: BUG #19013: When creating a table with the "...LIKE...INCLUDING ALL" construct, REPLICA IDENTITY output is wrong