2012/11/15 Xiaobo Gu <guxiaobo1982@gmail.com>:
> How can I list all schema names inside a PostgreSQL database through
> SQL, especially thoese without any objects created inside it.
Something like this:
select n.nspname, count(o.oid)
from pg_namespace n
left join pg_class o on n.oid=o.relnamespace
group by 1
order by count(o.oid)>0, 1;
I prefer to query PostgreSQL catalogs.
You can obtain the same information using information_schema queries.
--
Victor Y. Yegorov