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
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
- Re: [HACKERS] ALTER TABLE schema SCHEMA TO new_sch... Joe Conway
- Re: [HACKERS] ALTER TABLE schema SCHEMA TO ne... Tom Lane
- Re: [HACKERS] ALTER TABLE schema SCHEMA T... Joe Conway
- Re: [HACKERS] ALTER TABLE schema SCHE... Christopher Kings-Lynne
- Re: [HACKERS] ALTER TABLE schema ... Joe Conway
- Re: [HACKERS] ALTER TABLE sc... Fernando Nasser
- Re: [HACKERS] ALTER TABL... Joe Conway
- Re: [HACKERS] ALTER ... Fernando Nasser
- Re: [HACKERS] ALTER ... Rod Taylor
- Re: [HACKERS] ALTER TABLE sc... Christopher Kings-Lynne
- Re: [HACKERS] ALTER TABL... Rod Taylor