Thread: schemas in 7.3b1
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.
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
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
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.
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
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
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$ :\
> > 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
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?