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

From: sk baji <baji(dot)dba(at)gmail(dot)com>
To: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to list all schema names inside a PostgreSQL database through SQL
Date: 2012-11-15 13:13:13
Message-ID: CAAYGEJaJpoLVBJUKA28jMDBQHt_wuhNFOjRnLRyk8bx9bOPwmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If you are looking for list of empty schema's (No objects in schema), then
you can use below query:

select nspname from pg_namespace where oid not in (select relnamespace from
pg_class) and oid not in (select oid from pg_proc);

Regards,
Baji Shaik.

On Thu, Nov 15, 2012 at 6:13 PM, Achilleas Mantzios <
achill(at)matrix(dot)gatewaynet(dot)com> wrote:

> On Πεμ 15 Ποε 2012 20:31:05 Xiaobo Gu wrote:
> > Hi,
> >
> > How can I list all schema names inside a PostgreSQL database through
> > SQL, especially thoese without any objects created inside it.
> >
> >
>
> 1st solution :
>
> select catalog_name,schema_name from information_schema.schemata ;
>
> 2nd solution :
>
> select * from pg_namespace ;
>
> > Regards,
> >
> > Xiaobo Gu
> >
> >
> >
> -
> Achilleas Mantzios
> IT DEPT
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Igor Romanchenko 2012-11-15 14:40:28 Re: Strategies/Best Practises Handling Large Tables
Previous Message Achilleas Mantzios 2012-11-15 12:43:12 Re: How to list all schema names inside a PostgreSQL database through SQL