On Thu, Nov 7, 2024 at 12:03 PM Peter Eisentraut <pe...@eisentraut.org> wrote: > > On 07.11.24 05:13, Amit Kapila wrote: > > On Wed, Nov 6, 2024 at 4:18 PM vignesh C <vignes...@gmail.com> wrote: > >> > >> The attached v50 version patch has the changes for the same. > > Could you (everybody on this thread) please provide guidance how this > feature is supposed to interact with virtual generated columns [0]. I > don't think it's reasonably possible to replicate virtual generated > columns. >
I haven't studied the patch but can't we think of a way where we can compute the value of the virtual generated column on the fly (say by evaluating the required expression) before sending it to the client? We do evaluate the expressions during the row filter, so can't we do it for virtual-generated columns? I think we need some more work similar to row filter/column list where we need to ensure that the columns used in expressions for virtual generated columns must be part of replica identity. I haven't thought about all the details so I may be missing something. > I had previously suggested to make it more explicit that this > feature only works for stored generated columns (e.g., name the option > like that), but I don't see that this was considered. > It was considered in earlier versions of the patch like [1] but later we focussed more on getting key parts of the feature ready. Sorry for missing that part but we can do it now. The idea is that we explicitly mention in docs that the new option 'publish_generated_columns' will replicate only STORED generated columns and also explicitly compare 'attgenerated' as ATTRIBUTE_GENERATED_STORED during decoding and adjust comments. I suggest we do that for now. We could also consider naming the option as publish_stored_generated_columns but that way the name would be too long. The other idea could be to make the new option as a string but that would be useful only if we decide to replicate virtual generated columns. [1] - https://www.postgresql.org/message-id/CAHv8RjJsGWETA9U53iRiV2%2BVGtnHamEJ5PKMHUcfat269kQaSQ%40mail.gmail.com -- With Regards, Amit Kapila.