ALTER TABLE schema SCHEMA TO new_schema? - Mailing list pgsql-hackers

From Joe Conway
Subject ALTER TABLE schema SCHEMA TO new_schema?
Date
Msg-id 3DE99DD0.5080209@joeconway.com
Whole thread Raw
Responses Re: ALTER TABLE schema SCHEMA TO new_schema?
List pgsql-hackers
Someone asked earlier about how to change a bunch of existing tables int the 
PUBLIC schema to some other schema. For grins I tried:

regression=# select oid,* from pg_namespace ;  oid   |  nspname   | nspowner | nspacl
--------+------------+----------+--------     11 | pg_catalog |        1 | {=U}     99 | pg_toast   |        1 | {=}
2200| public     |        1 | {=UC}  16766 | pg_temp_1  |        1 | 556829 | bar        |        1 |
 
(5 rows)

regression=# update pg_class set relnamespace=556829 where relname = 'foo' and 
relnamespace=2200;
UPDATE 1

and it seemed to work fine (i.e. moved foo from schema public to schema bar). 
But it made me wonder if we shouldn't have:
  ALTER TABLE table SCHEMA TO new_schema

as a supported method to do this?

Joe



pgsql-hackers by date:

Previous
From: "Nicolai Tufar"
Date:
Subject: Re: Hard-coded PUBLIC in pg_dump
Next
From: Tom Lane
Date:
Subject: Re: ALTER TABLE schema SCHEMA TO new_schema?