Re: Dealing with schema in psql utility? - Mailing list pgsql-general

From Tariq Muhammad
Subject Re: Dealing with schema in psql utility?
Date
Msg-id Pine.LNX.4.21.0302201411590.15424-100000@genesis.int.libertyrms.com
Whole thread Raw
In response to Dealing with schema in psql utility?  (Dan Delaney <ddelaney@powercreative.com>)
Responses Re: Dealing with schema in psql utility?
Re: Dealing with schema in psql utility?
List pgsql-general
On Thu, 20 Feb 2003, Dan Delaney wrote:

> 1) get a list of the schema that have been created in the current
> database

select * from pg_namespace ;

> 2) View the list of tables in a schema other than "public"?

Fist get the oid of the schema that you want to get the table list for :

select oid from pg_namespace where nspname = 'schema_name';

then

select relname from pg_class where relnamespace = oid; ## above oid.

> 3) Rename a schema (is there an "alter schema" statement)?

You can do it as superuser

update pg_namespace set nspname='new_schema_name' where
nspname='schema_name';


     _/_/     _/_/    _/_/  Tariq Muhammad
    _/  _/  _/   _/ _/  _/  tariq@libertyrms.info
   _/   _/ _/_/_/  _/_/_/   v:416-646-3304 x 111
  _/   _/ _/   _/ _/  _/    c:416-455-0272
 _/_/_/  _/_/_/  _/  _/     p:416-381-1457
_________________________________________________
     Liberty Registry Management Services Co.


pgsql-general by date:

Previous
From: "John Menke"
Date:
Subject: OT: Struts Online Training with PostgreSQL
Next
From: Richard Huxton
Date:
Subject: Re: What is the quickest query in the database?