Re: How to list all schema names inside a PostgreSQL database through SQL

Поиск
Список
Период
Сортировка
От Виктор Егоров
Тема Re: How to list all schema names inside a PostgreSQL database through SQL
Дата
Msg-id CAGnEboigb6ksS+ynekS1dsUYdp+8Gs8KWW9A4YZF5ajMHSxCsA@mail.gmail.com
обсуждение исходный текст
Ответ на How to list all schema names inside a PostgreSQL database through SQL  (Xiaobo Gu <guxiaobo1982@gmail.com>)
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: Xiaobo Gu
Дата:
Сообщение: How to list all schema names inside a PostgreSQL database through SQL
Следующее
От: Achilleas Mantzios
Дата:
Сообщение: Re: How to list all schema names inside a PostgreSQL database through SQL