schemas in 7.3b1

Started by Chrisover 23 years ago9 messagesgeneral
Jump to latest
#1Chris
pggeneral@designmagick.com

Hi all,

Just a quick question.

Is there an easy way to get a list of schemas in a database?

serverlogs=# SELECT version();
version
---------------------------------------------------------------
PostgreSQL 7.3b1 on i586-pc-linux-gnu, compiled by GCC 2.95.3
(1 row)

serverlogs=# CREATE SCHEMA dwarf;
CREATE SCHEMA
serverlogs=# SELECT current_schemas(true);
current_schemas
---------------------
{pg_catalog,public}
(1 row)

I found the pg_namespace table, but that doesn't tell me what database
has a particular schema..

I checked the developer docs but I couldn't find anything there.

Thanks,
Chris.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Chris (#1)
Re: schemas in 7.3b1

Chris <pggeneral@designmagick.com> writes:

Is there an easy way to get a list of schemas in a database?
I found the pg_namespace table, but that doesn't tell me what database
has a particular schema.

Yours. pg_namespace is local to a database, same as most other
system catalogs.

We had meant to add a \d command for listing schemas in psql, but
both \ds and \dS are taken already :-(. Any ideas out there for
a reasonable choice?

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: schemas in 7.3b1

Tom Lane wrote:

Chris <pggeneral@designmagick.com> writes:

Is there an easy way to get a list of schemas in a database?
I found the pg_namespace table, but that doesn't tell me what database
has a particular schema.

Yours. pg_namespace is local to a database, same as most other
system catalogs.

We had meant to add a \d command for listing schemas in psql, but
both \ds and \dS are taken already :-(. Any ideas out there for
a reasonable choice?

Is this a TODO item?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#4Lee Kindness
lkindness@csl.co.uk
In reply to: Tom Lane (#2)
Re: schemas in 7.3b1

Tom Lane writes:

We had meant to add a \d command for listing schemas in psql, but
both \ds and \dS are taken already :-(. Any ideas out there for
a reasonable choice?

Howabout '\dschema', or would non-single-character choices need
further parsing code?

For want of anything better... '\dz'.

L.

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#3)
Re: schemas in 7.3b1

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Tom Lane wrote:

We had meant to add a \d command for listing schemas in psql, but
both \ds and \dS are taken already :-(. Any ideas out there for
a reasonable choice?

Is this a TODO item?

Yeah, at this point I guess it is --- I had meant to get it done for
7.3, but I suppose it's too late now.

Now that I think about it, casts and conversions are two more new object
kinds that perhaps deserve \d support.

regards, tom lane

#6Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#5)
Re: schemas in 7.3b1

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Tom Lane wrote:

We had meant to add a \d command for listing schemas in psql, but
both \ds and \dS are taken already :-(. Any ideas out there for
a reasonable choice?

Is this a TODO item?

Yeah, at this point I guess it is --- I had meant to get it done for
7.3, but I suppose it's too late now.

Now that I think about it, casts and conversions are two more new object
kinds that perhaps deserve \d support.

Added to TODO:

* Add schema, cast, and conversion backslash commands to psql

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#7frbn
frbn@efbs-seafrigo.fr
In reply to: Chris (#1)
Re: schemas in 7.3b1

Lee Kindness a écrit:

Tom Lane writes:

We had meant to add a \d command for listing schemas in psql, but
both \ds and \dS are taken already :-(. Any ideas out there for
a reasonable choice?

Howabout '\dschema', or would non-single-character choices need
further parsing code?

For want of anything better... '\dz'.

or d$ :\

#8Thomas Pfau
pfau@gw.rane.net
In reply to: Tom Lane (#5)
Re: schemas in 7.3b1

Tom Lane wrote:

We had meant to add a \d command for listing schemas in psql, but
both \ds and \dS are taken already :-(. Any ideas out there for
a reasonable choice?

\l is currently used to list databases. How about \ls to list
schemas?

#9Sean Chittenden
sean@chittenden.org
In reply to: Tom Lane (#2)
Re: schemas in 7.3b1

Is there an easy way to get a list of schemas in a database?
I found the pg_namespace table, but that doesn't tell me what database
has a particular schema.

Yours. pg_namespace is local to a database, same as most other
system catalogs.

We had meant to add a \d command for listing schemas in psql, but
both \ds and \dS are taken already :-(. Any ideas out there for
a reasonable choice?

\dn [PATTERN] list schema names/name spaces

-sc

--
Sean Chittenden