git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fe6a20c)
Ensure pg_filenode_relation(0, 0) returns NULL.
2021年6月12日 17:29:24 +0000 (13:29 -0400)
2021年6月12日 17:29:24 +0000 (13:29 -0400)
Previously, a zero value for the relfilenode resulted in
a confusing error message about "unexpected duplicate".
This function returns NULL for other invalid relfilenode
values, so zero should be treated likewise.

It's been like this all along, so back-patch to all supported
branches.

Justin Pryzby

Discussion: https://postgr.es/m/20210612023324.GT16435@telsasoft.com


diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c
index 3c70bb59433ec35619453f62d41fdb7e06f0f41d..9c39e7d3b343aa16d066d2bf64f12b6d6e61bf6c 100644 (file)
--- a/src/backend/utils/adt/dbsize.c
+++ b/src/backend/utils/adt/dbsize.c
@@ -903,7 +903,11 @@ pg_filenode_relation(PG_FUNCTION_ARGS)
{
Oid reltablespace = PG_GETARG_OID(0);
Oid relfilenode = PG_GETARG_OID(1);
- Oid heaprel = InvalidOid;
+ Oid heaprel;
+
+ /* test needed so RelidByRelfilenode doesn't misbehave */
+ if (!OidIsValid(relfilenode))
+ PG_RETURN_NULL();
heaprel = RelidByRelfilenode(reltablespace, relfilenode);
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /