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)
This entry was posted in PostgreSQL on by .
Unknown's avatar

About SandeepSingh

Hi, I am working in IT industry with having more than 15 year of experience, worked as an Oracle DBA with a Company and handling different databases like Oracle, SQL Server , DB2 etc Worked as a Development and Database Administrator.

Leave a Reply