Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1585ff7

Browse files
committed
Don't allow GetTransactionSnapshot() in logical decoding
A historic snapshot should only be used for catalog access, notgeneral queries. We never call GetTransactionSnapshot() during logicaldecoding, which is good because it wouldn't be very sensible, so thecode to deal with that was unreachable and untested. Turn it into anerror, to avoid doing that in the future either.Discussion:https://www.postgresql.org/message-id/a868fe78-ddb4-4b0a-9b96-873d91d93cfd@iki.fi
1 parent952365c commit1585ff7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

‎src/backend/utils/time/snapmgr.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,12 @@ Snapshot
212212
GetTransactionSnapshot(void)
213213
{
214214
/*
215-
* Return historic snapshot if doing logical decoding. We'll never need a
216-
* non-historic transaction snapshot in this (sub-)transaction, so there's
217-
* no need to be careful to set one up for later calls to
218-
* GetTransactionSnapshot().
215+
* This should not be called while doing logical decoding. Historic
216+
* snapshots are only usable for catalog access, not for general-purpose
217+
* queries.
219218
*/
220219
if (HistoricSnapshotActive())
221-
{
222-
Assert(!FirstSnapshotSet);
223-
returnHistoricSnapshot;
224-
}
220+
elog(ERROR,"cannot take query snapshot during logical decoding");
225221

226222
/* First call in transaction? */
227223
if (!FirstSnapshotSet)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp