Skip site navigation (1) Skip section navigation (2)

Re: Listing Schemas - Revisited

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Chris Campbell <ccampbell(at)cascadeds(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Listing Schemas - Revisited
Date: 2010-08-16 15:50:55
Message-ID: AANLkTikD7foLSsbj2OKXDm6QMYgt_8VwoyqvA1L5_vp7@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
On Tue, Aug 10, 2010 at 1:42 PM, Chris Campbell <ccampbell(at)cascadeds(dot)com> wrote:
> Hi, a while back I saw a thread about how to list schemas.  The solution
> presented was:
>
> Select * FROM pg_namespace
>
> That’s great except the results include non schema data and no real way
> (that I can tell) to differentiate the actual schemas from the other data.
> In addition, I need to include the schema comments.  So to summarize my
> particular need:  I need to issue a select statement that returns “Schema
> Name” and “Comments” for the given database.

Hrm, what sort of "other data" do you see in pg_namespace? And how about this:

SELECT nspname AS "Schema Name", pg_catalog.obj_description(oid) AS "Comments"
FROM pg_namespace
WHERE nspname !~ '^pg_.*';

Josh

In response to

Responses

pgsql-novice by date

Next:From: Chris CampbellDate: 2010-08-16 16:15:48
Subject: Re: Listing Schemas - Revisited
Previous:From: Tom LaneDate: 2010-08-16 03:58:46
Subject: Re: How to trap invalid enum input exception?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group