Re: Logical Replication Custom Column Expression - Mailing list pgsql-hackers

From Stavros Koureas
Subject Re: Logical Replication Custom Column Expression
Date
Msg-id CA+O1jk4JOq36zsjg=fAcRRQ4Kbm3AJ9dnBcoVS=CV54cLsmfaQ@mail.gmail.com
Whole thread Raw
In response to Re: Logical Replication Custom Column Expression  (Stavros Koureas <koureasstavros@gmail.com>)
List pgsql-hackers
>> And yes, probably you need to change the way you reply to email on
>> this list. Top-posting is generally avoided. See
>> https://wiki.postgresql.org/wiki/Mailing_Lists.

>Thanks for bringing this into the discussion :)

Thinking these days more about this topic, subscriber name is not a bad idea, although it makes sense to be able to give your own value even on subscriber level, for example an integer.
Having a custom integer value is better as definitely this integer will participate later in all joins beside the tables and for sure joining with an integer it would be quicker rather than joining on a character varying (plus the rest of the columns).
In addition, discussing with other people and also on Stack Overflow/DBAExchange I have found that other people think it is a great enhancement for analytical purposes.

Στις Τετ 30 Νοε 2022 στις 10:39 π.μ., ο/η Stavros Koureas <koureasstavros@gmail.com> έγραψε:


Στις Τρί 29 Νοε 2022 στις 3:27 μ.μ., ο/η Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> έγραψε:
> That would be too restrictive - not necessarily in your application
> but generally. There could be some tables where consolidating rows
> with same PK from different publishers into a single row in subscriber
> would be desirable. I think we need to enable the property for every
> subscriber that intends to add publisher column to the desired and
> subscribed tables. But there should be another option per table which
> will indicate that receiver should add publisher when INSERTING row to
> that table.

So we are discussing the scope level of this property, if this property will be implemented on subscriber level or on subscriber table.
In that case I am not sure how this will be implemented as currently postgres subscribers can have multiple tables streamed from a single publisher.
In that case we may have an additional syntax on subscriber, for example:

CREATE SUBSCRIPTION sub1 CONNECTION 'host=localhost port=5432 user=postgres password=XXXXXX dbname=publisher1' PUBLICATION pub1 with (enabled = false, create_slot = false, slot_name = NONE, tables = {tableA:union, tableB:none, ....});

Something like this?

> And yes, probably you need to change the way you reply to email on
> this list. Top-posting is generally avoided. See
https://wiki.postgresql.org/wiki/Mailing_Lists.

Thanks for bringing this into the discussion :)

pgsql-hackers by date:

Previous
From: Marcos Pegoraro
Date:
Subject: Re: Understanding years part of Interval
Next
From: Andrew Dunstan
Date:
Subject: Re: run pgindent on a regular basis / scripted manner