RE: Identity/Serial Column In Subscriber's Tables

From: Avi Weinberg <AviW(at)gilat(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: RE: Identity/Serial Column In Subscriber's Tables
Date: 2021-12-09 14:19:35
Message-ID: DB9PR07MB7180DD193B71582F9EC1755DCB709@DB9PR07MB7180.eurprd07.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Laurenz

Thanks for your answer.

If I do not modify data on the subscriber side, the best practice will be to not to define the column as identity or it is better to have subscriber's table definition as close as possible to the publisher and leave it as identity?

Thanks

-----Original Message-----
From: Laurenz Albe [mailto:laurenz(dot)albe(at)cybertec(dot)at]
Sent: Thursday, December 9, 2021 1:51 PM
To: Avi Weinberg <AviW(at)gilat(dot)com>; pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Identity/Serial Column In Subscriber's Tables

On Thu, 2021-12-09 at 09:13 +0000, Avi Weinberg wrote:
> What is the best practice when dealing with Identity/Serial column in logical replication.
> Should the subscriber table have this column also defined as Identity/Serial or have it defined as regular integer?
> Is leaving it as Identity/Serial also on subscriber tables, can potentially cause a problem?

It does not really matter if you use "serial" or an identity column on the logical standby or not. The sequence on the standby won't be advanced.

The best way to prevent conflicts from happening is *not* to modify the data on the standby.

Yours,
Laurenz Albe
--
Cybertec | https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.cybertec-postgresql.com%2F&amp;data=04%7C01%7CAviW%40gilat.com%7C9d8efd6e75b5451a878708d9bb0a2da7%7C7300b1a3573a401092a61c65cd85e927%7C0%7C0%7C637746474671657970%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=SK9ZhzUJireCa4ClEWRGyHX2x6F6f%2FkM4V8Iw4l8vZY%3D&amp;reserved=0

IMPORTANT - This email and any attachments is intended for the above named addressee(s), and may contain information which is confidential or privileged. If you are not the intended recipient, please inform the sender immediately and delete this email: you should not copy or use this e-mail for any purpose nor disclose its contents to any person.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shaozhong SHI 2021-12-09 14:46:05 Re: Detecting repeated phrase in a string
Previous Message Peter J. Holzer 2021-12-09 13:35:10 Re: Detecting repeated phrase in a string