Add pg_relation_by_filenode(reltbspc, filenode) admin function - Mailing list pgsql-hackers

From Andres Freund
Subject Add pg_relation_by_filenode(reltbspc, filenode) admin function
Date
Msg-id 1347833737-16484-1-git-send-email-andres@2ndquadrant.com
Whole thread Raw
In response to [PATCH 5/8] Add a new syscache to fetch a pg_class entry via (reltablespace, relfilenode)  (Andres Freund <andres@2ndquadrant.com>)
Responses [PATCH 2/2] Add a new function pg_relation_by_filenode to lookup up a relation given the tablespace and the filenode OIDs  (Andres Freund <andres@2ndquadrant.com>)
[PATCH 1/2] Add a new relmapper.c function RelationMapFilenodeToOid that acts as a reverse of RelationMapOidToFilenode  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Now that I proposed a new syscache upthread its easily possible to provide
pg_relation_by_filenode which I wished for multiple times in the past when
looking at filesystem activity and wondering which table does what. You can
sortof get the same result via

SELECT oid FROM (      SELECT oid, pg_relation_filenode(oid::regclass) filenode      FROM pg_class WHERE relkind !=
'v'
) map
WHERE map.filenode = ...;

but thats neither efficient nor obvious.

So, two patches to do this:


Did others need this in the past? I can live with the 2nd patch living in a
private extension somewhere. The first one would also be useful for some
error/debug messages during decoding...

Greetings,

Andres



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [ADMIN] pg_upgrade from 9.1.3 to 9.2 failed
Next
From: Andres Freund
Date:
Subject: [PATCH 2/2] Add a new function pg_relation_by_filenode to lookup up a relation given the tablespace and the filenode OIDs