Обсуждение: Identity/Serial Column In Subscriber's Tables

Поиск
Список
Период
Сортировка

Identity/Serial Column In Subscriber's Tables

От
Avi Weinberg
Дата:

Hi Experts,

 

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?

 

Thanks!

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.

Re: Identity/Serial Column In Subscriber's Tables

От
Laurenz Albe
Дата:
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://www.cybertec-postgresql.com




RE: Identity/Serial Column In Subscriber's Tables

От
Avi Weinberg
Дата:
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
isbetter 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.albe@cybertec.at]
Sent: Thursday, December 9, 2021 1:51 PM
To: Avi Weinberg <AviW@gilat.com>; pgsql-general@lists.postgresql.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
standbywon'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&data=04%7C01%7CAviW%40gilat.com%7C9d8efd6e75b5451a878708d9bb0a2da7%7C7300b1a3573a401092a61c65cd85e927%7C0%7C0%7C637746474671657970%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=SK9ZhzUJireCa4ClEWRGyHX2x6F6f%2FkM4V8Iw4l8vZY%3D&reserved=0

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