SELECT spcname AS tblspc, fsname AS filespc, fsedbid AS seg_dbid, fselocation AS datadir
FROM pg_tablespace pgts, pg_filespace pgfs,
pg_filespace_entry pgfse
WHERE pgts.spcfsoid=pgfse.fsefsoid
AND pgfse.fsefsoid=pgfs.oid
ORDER BY tblspc, seg_dbid;
select c.relname, d.dat2tablespace tablespace_id, d.oid database_id, c.relfilenode table_id from pg_database d, pg_class c, pg_namespace n
where c.relnamespace = n.oid
and d.datname = current_database()
and n.nspname = 'qbyps'
and c.relname = 'p';
SELECT pgfs.oid fs_id,pgts.oid ts_id, spcname AS tblspc, fsname AS filespc, fsedbid AS seg_dbid, fselocation AS datadir
FROM pg_tablespace pgts, pg_filespace pgfs,
pg_filespace_entry pgfse
WHERE pgts.spcfsoid=pgfse.fsefsoid
AND pgfse.fsefsoid=pgfs.oid
ORDER BY tblspc, seg_dbid;