Skip to content

Commit 493461d

Browse files
committed
Start transaction in origin message
We don't start new transactions in begin message to not have to replay empty transactions but in order to work with origins we have to be inside a transaction, so start it in origin message which always comes right after begin and before any DML message.
1 parent 0e18d7e commit 493461d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pglogical_apply.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ handle_origin(StringInfo s)
231231
if (!in_remote_transaction || IsTransactionState())
232232
elog(ERROR, "ORIGIN message sent out of order");
233233

234+
/* We have to start transaction here so that we can work with origins. */
235+
ensure_transaction();
236+
234237
origin = pglogical_read_origin(s, &remote_origin_lsn);
235238
remote_origin_id = replorigin_by_name(origin, false);
236239
}

0 commit comments

Comments
 (0)