Wednesday, 30 March 2011

postgres - how to list all tables

Here is the best way (I have found) to list all tables in a postgres database

select relname from pg_class pc left join pg_namespace ns ON ns.oid=pc.relnamespace where pc.relkind='r' and nspname='public' order by relname asc;

No comments: