Alvaro Herrera wrote:
> I agree -- I think logicalrep_write_attrs() should not use
> RelationGetIndexAttrBitmap at all but instead use some lower-level way
> to obtain columns of the replica identity. I don't know whether there
> are historical-snapshot-related considerations to care about, in this
> code, though.
Here's a patch. There is a disadvantage: one additional syscache lookup
each time logicalrep_write_attrs() is called. I think that's all right,
since that's done once for each relation being replicated (not, say,
once per tuple or once per transaction). Even so, I tried to move this
code as a special "quick-path" case in RelationGetIndexAttrBitmap, so
that it could be cached separately without processing the other indexes.
That turned out a bit too messy for my taste.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services