postgres.git / summary / log / commit / refs
commit 661f821ef0c3078c70096b09dc44fb8fed56f2b4
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Fri Aug 22 10:35:05 2025 +0000
First released in: 19.0
Use ereport() rather than elog()
Noah pointed this out before I committed 50f770c3d9, but I
accidentally pushed the old version with elog() anyway. Oops.
Reported-by: Noah Misch <noah@leadboat.com>
Discussion: https://www.postgresql.org/message-id/20250820003756.31.nmisch@google.com
src/backend/access/heap/heapam.c | 6 ++++--
src/backend/access/index/indexam.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index ee692c03c3c..7491cc3cb93 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -1148,8 +1148,10 @@ heap_beginscan(Relation relation, Snapshot snapshot,
IsHistoricMVCCSnapshot(snapshot) &&
!RelationIsAccessibleInLogicalDecoding(relation))
{
- elog(ERROR, "cannot query non-catalog table \"%s\" during logical decoding",
- RelationGetRelationName(relation));
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_TRANSACTION_STATE),
+ errmsg("cannot query non-catalog table \"%s\" during logical decoding",
+ RelationGetRelationName(relation))));
}
/*
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c
index 31b22d9f397..86d11f4ec79 100644
--- a/src/backend/access/index/indexam.c
+++ b/src/backend/access/index/indexam.c
@@ -267,8 +267,10 @@ index_beginscan(Relation heapRelation,
if (IsHistoricMVCCSnapshot(snapshot) &&
!RelationIsAccessibleInLogicalDecoding(heapRelation))
{
- elog(ERROR, "cannot query non-catalog table \"%s\" during logical decoding",
- RelationGetRelationName(heapRelation));
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_TRANSACTION_STATE),
+ errmsg("cannot query non-catalog table \"%s\" during logical decoding",
+ RelationGetRelationName(heapRelation))));
}
scan = index_beginscan_internal(indexRelation, nkeys, norderbys, snapshot, NULL, false);
[parent: 50f770c3d92c]