]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix negative bitmapset member not allowed error in logical replication
authorPeter Eisentraut <peter@eisentraut.org>
Thu, 7 Nov 2019 12:48:59 +0000 (13:48 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Sat, 9 Nov 2019 07:35:44 +0000 (08:35 +0100)
commit1c60e40ad54b18685436443da3c56a7018a35475
treecbc3ef1d66589cf8e02e7963516ce5a98cc2b08c
parent943b447d303e6d0a7635d39ac552550b77b96cef
Fix negative bitmapset member not allowed error in logical replication

This happens when we add a replica identity column on a subscriber
that does not yet exist on the publisher, according to the mapping
maintained by the subscriber.  Code that checks whether the target
relation on the subscriber is updatable would check the replica
identity attribute bitmap with a column number -1, which would result
in an error.  To fix, skip such columns in the bitmap lookup and
consider the relation not updatable.  The result is consistent with
the rule that the replica identity columns on the subscriber must be a
subset of those on the publisher, since if the column doesn't exist on
the publisher, the column set on the subscriber can't be a subset.

Reported-by: Tim Clarke <tim.clarke@minerva.info>
Analyzed-by: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Discussion: https://www.postgresql.org/message-id/flat/a9139c29-7ddd-973b-aa7f-71fed9c38d75%40minerva.info
src/backend/replication/logical/relation.c
src/test/subscription/t/008_diff_schema.pl