Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: to get the list of schemas in postgresql db

by erix (Vicar)
on Dec 04, 2011 at 11:27 UTC ( #941633=note: print w/replies, xml ) Need Help??

in reply to to get the list of schemas in postgresql db

But TMTOWTDI (SQL standard compliant):

select schema_name from information_schema.schemata where schema_name <> 'information_schema' -- exclude 'system' schemata and schema_name !~ E'^pg_' -- exclude more 'system' (pg +-specific)

In psql there is \dn to retrieve schema names. If PGPASSFILE is set (and possibly more PG* environment variables like PGDATABASE), you can just talk to the database from the commandline:

echo '\dn' | psql

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://941633]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2016-10-26 21:40 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (350 votes). Check out past polls.