From: dbman@sqlexec.com <dbman@sqlexec.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #19013: When creating a table with the "...LIKE...INCLUDING ALL" construct, REPLICA IDENTITY output is wrong
Date: Wed, 6 Aug 2025 11:42:06 -0400
Message-ID: <cf5057c2-b9f9-4a18-961b-de3d22897650@sqlexec.com> (raw)
In-Reply-To: <CAKFQuwbnfSySRV-axfQXAsd37ERQf=8L5FQSVnRM27aBmW5uFA@mail.gmail.com>
References: <19013-04a5827d56b97202@postgresql.org>
<CAKFQuwba_gRmzi4C9Uu=_+AW8L-z=V0MpkPgk3HNBoKkfA09zA@mail.gmail.com>
<fade757a-328a-46fc-a117-8d22459e35d7@sqlexec.com>
<CAKFQuwbnfSySRV-axfQXAsd37ERQf=8L5FQSVnRM27aBmW5uFA@mail.gmail.com>
On 8/6/2025 10:53 AM, David G. Johnston wrote:
> On Wednesday, August 6, 2025, dbman@sqlexec.com <dbman@sqlexec.com> wrote:
>
> On 8/5/2025 7:01 PM, David G. Johnston wrote:
>> On Tue, Aug 5, 2025 at 2:43 PM PG Bug reporting form
>> <noreply@postgresql.org> wrote:
>>
>> The following bug has been logged on the website:
>>
>> Bug reference: 19013
>> Logged by: Michael Vitale
>> Email address: dbman@sqlexec.com
>> PostgreSQL version: 17.5
>> Operating system: CentOS 8 Streams
>> Description:
>>
>>
>> We don't document that the replica identity attribute of a table
>> is something that can be copied. 'ALL' only covers those things
>> which are documented as being copy-able.
>>
>> David J.
>>
> I understand your logic about not everything is copy-able, just
> what is documented, but this is a different case. I am not
> complaining that it is not copying the REPLICA IDENTITY, but
> rather that it is copying it in a WRONG WAY, changing its property
> from FULL to DEFAULT. I think that is a reasonable complaint. If
> you are going to attempt to copy it erroneously, then I think you
> should consider that a bug and fix it. Otherwise, remove it and
> don't try to copy it. Does that seem reasonable?
>
>
> Reading the docs, if you just perform a create table (no like) you’ll
> find pg_class.relreplident is set to “d”. That field is never null.
> There is no concept of “remove it”.
>
> David J.
>
Good point aboutg the default value for pg_class.relreplident is always
"d", but maybe it should be "n" which indicates there is no REPLICA
IDENTITY. Otherwise the way it is now, whenever there is a REPLICA
IDENTITY on a table and you use the CREATE LIKE construct, it will
always overwrite the "f" and "i" values with "d", thereby actually
changing the state of the REPLICA IDENTITY from FULL or INDEX to
DEFAULT. 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. Othewise you have an unintended DDL change consequence to
this action. Perhaps add a warning about this in the description for
CREATE...LIKE in the docs, or even mention it in the section that
describes REPLICA IDENTITY, or both.
Michael V
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: dbman@sqlexec.com, david.g.johnston@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19013: When creating a table with the "...LIKE...INCLUDING ALL" construct, REPLICA IDENTITY output is wrong
In-Reply-To: <cf5057c2-b9f9-4a18-961b-de3d22897650@sqlexec.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox