mirror of
https://github.com/postgres/postgres.git
synced 2025-09-05 02:22:28 +03:00
Fix updating of pg_subscription_rel from workers
A logical replication worker should not insert new rows into pg_subscription_rel, only update existing rows, so that there are no races if a concurrent refresh removes rows. Adjust the API to be able to choose that behavior. Author: Masahiko Sawada <sawada.mshk@gmail.com> Reported-by: tushar <tushar.ahuja@enterprisedb.com>
This commit is contained in:
@@ -451,7 +451,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
|
||||
rv->schemaname, rv->relname);
|
||||
|
||||
SetSubscriptionRelState(subid, relid, table_state,
|
||||
InvalidXLogRecPtr);
|
||||
InvalidXLogRecPtr, false);
|
||||
}
|
||||
|
||||
ereport(NOTICE,
|
||||
@@ -574,7 +574,7 @@ AlterSubscription_refresh(Subscription *sub, bool copy_data)
|
||||
{
|
||||
SetSubscriptionRelState(sub->oid, relid,
|
||||
copy_data ? SUBREL_STATE_INIT : SUBREL_STATE_READY,
|
||||
InvalidXLogRecPtr);
|
||||
InvalidXLogRecPtr, false);
|
||||
ereport(NOTICE,
|
||||
(errmsg("added subscription for table %s.%s",
|
||||
quote_identifier(rv->schemaname),
|
||||
|
Reference in New Issue
Block a user