# pg\_filenode.map

Published articles for pg\_filenode.map.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Decoding pg\_filenode.map files with pg\_filenodemapdata

DevFeed: [Decoding pg\_filenode.map files with pg\_filenodemapdata](<https://devfeed.tech/articles/decoding-pg-filenode-map-files-with-pg-filenodemapdata-33661.md>)

Original publisher: [Read original article](<https://pgeoghegan.blogspot.com/2018/03/decoding-pgfilenodemapdata.html>)

Author: Peter Geoghegan (noreply@blogger.com)

Published: 2018-03-20T04:44:00Z

Content type: tutorial

Language: en

Sources: [Peter Geoghegan's blog](<https://devfeed.tech/sources/peter-geoghegan-s-blog.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [postgresql clusters](<https://devfeed.tech/topics/postgresql-clusters.md>)

Tags: [file](<https://devfeed.tech/tags/file.md>), [filesystem](<https://devfeed.tech/tags/filesystem.md>), [internals](<https://devfeed.tech/tags/internals.md>), [pg-filenode-map](<https://devfeed.tech/tags/pg-filenode-map.md>), [pg-hexedit](<https://devfeed.tech/tags/pg-hexedit.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [query](<https://devfeed.tech/tags/query.md>), [sql](<https://devfeed.tech/tags/sql.md>), [vacuum](<https://devfeed.tech/tags/vacuum.md>)

### AI overview

This article explains how to identify the filesystem relation file for a PostgreSQL table or index when normal SQL queries are unavailable because system catalog corruption prevents a database connection. It introduces pg_filenodemapdata, a pg_hexedit-bundled program that reads pg_filenode.map files to determine the relfilenode numbers associated with system catalog entries.

### Source excerpt

From time to time, you may need to figure out which file in a PostgreSQL data directory corresponds to a particular table or index in the database. For example, pg_hexedit users sometimes need this information, since pg_hexedit is a frontend utility that works by reading relation files from the filesystem. In practice, a pg_hexedit convenience script can usually be used instead. Users need only give the name of the table or index that is to be examined. The convenience scripts call the built-in function pg_relation_filepath() via an SQL query. This approach won't always work, though. pg_hexedit is a tool for investigating corruption, and sometimes corruption can affect system catalogs in a way that makes it impossible to even establish a connection to the database. You may find that you're greeted with an arcane error any time you attempt to connect to the database. The error may look something like this: ERROR: catalog is missing 3 attribute(s) for relid 827 In this example, the issue that prevents us from connecting must have something to do with the system catalog pg_attribute, and/or an index on pg_attribute. The catalog with relid/pg_class OID 827 (pg_default_acl_role_nsp_obj_index) appears to lack pg_attribute entries, making the built-in/catalog index pg_default_acl_role_nsp_obj_index unusable (note that there is no reason to think that the underlying relfile for pg_default_acl_role_nsp_obj_index is itself corrupt). To confirm this theory, we'll need to directly examine the pg_attribute relation for the database. Of course, there is no way to query pg_attribute, because we cannot connect. Moreover, there is no easy way to know where the files associated with pg_attribute are, so that we can at least examine pg_attribute using pg_hexedit. The "relfilenode" number that corresponds to pg_attribute (or any other table) isn't hard-coded or stable. For example, the relfilenode of a table will change any time VACUUM FULL is used on the table. I've written a tool cal