ALTER TABLE schema SCHEMA TO new_schema?

From: Joe Conway <mail(at)joeconway(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: ALTER TABLE schema SCHEMA TO new_schema?
Date: 2002-12-01 05:27:44
Message-ID: 3DE99DD0.5080209@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2002-12-01 05:32:22 Re: Segmentation fault while COPY in 7.3
Previous Message Nicolai Tufar 2002-12-01 05:11:31 Re: Hard-coded PUBLIC in pg_dump