]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Use ereport() rather than elog()
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 22 Aug 2025 10:35:05 +0000 (13:35 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 22 Aug 2025 10:35:05 +0000 (13:35 +0300)
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
src/backend/access/index/indexam.c

index ee692c03c3c8195fa98de35643f35830991f5244..7491cc3cb93bcab370311968505656a01c86c4e0 100644 (file)
@@ -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))));
        }
 
        /*
index 31b22d9f397803811e18af545a81d08fa61f3638..86d11f4ec791d0d04a06619b0228644c9eb29ac3 100644 (file)
@@ -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);