\t
\o T740A_files.lst
--
-- Shows filenames of database
--
SELECT CASE
         WHEN c.relname = 'pg_xactlock'
         THEN NULL
         WHEN c.relisshared = 't'
         THEN '${PG_ADMIN}/global/' || c.relfilenode
         WHEN db.datpath = ''
         THEN '${PG_ADMIN}/' || 'base/' || db.oid || '/' || c.relfilenode
         ELSE '${' || db.datpath || '}/base/' || db.oid || '/' || c.relfilenode
       END AS file_name
FROM pg_namespace nc, pg_class c, pg_user u, pg_database db
WHERE c.relnamespace = nc.oid
  AND u.usesysid = c.relowner
  AND db.datname = current_database()
ORDER BY file_name;
