Check the filename of the table/relation in PostgreSQL

Find the filename in which table/relation stored in PostgreSQL

Check the table filename in PostgreSQL

SELECT pg_relation_filepath('table_name');

Example:
testdb=# SELECT pg_relation_filepath('rental');
 pg_relation_filepath
----------------------
 base/16398/16524
(1 row)

Check the complete location of files where it placed:

testdb=# show data_directory;
           data_directory
-------------------------------------
 C:/Program Files/PostgreSQL/15/data
(1 row)

Check the file name or location of table name:


SELECT pg_relation_filepath('rental');
Example:
testdb=# SELECT pg_relation_filepath('rental');
 pg_relation_filepath
----------------------
 base/16398/16524
(1 row)
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.