From: | Andrew Rawnsley <ronz(at)ravensfield(dot)com> |
---|---|
To: | Lee Kindness <lkindness(at)csl(dot)co(dot)uk> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Move a table to another schema |
Date: | 2003-11-17 17:42:33 |
Message-ID: | 6CCDCF95-1925-11D8-BA13-000393A47FCC@ravensfield.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I would imagine the safest way would be to recreate the table in the
new schema and do a INSERT INTO ...SELECT * FROM ....
Not elegant, but perfectly safe. You mess with the pg_* catalogs at
your own risk.
On Nov 17, 2003, at 11:05 AM, Lee Kindness wrote:
> I have many tables created in the "public" schema and I would like to
> migrate these into an "x001" schema. Unfortunately there is no ALTER
> TABLE construct for this... The following SQL would seem to move the
> "zxc" table from "public.zxc" to "x001.zxc":
>
> UPDATE pg_class
> SET relnamespace = (SELECT oid FROM pg_namespace WHERE nspname =
> 'x001')
> FROM pg_namespace
> WHERE pg_class.relname = 'zxc' AND
> pg_namespace.nspname = 'public' AND
> pg_class.relnamespace = pg_namespace.oid
>
> Has anyone else addressed this before? Recommendations?
>
> Thanks, L.
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
--------------------
Andrew Rawnsley
President
The Ravensfield Digital Resource Group, Ltd.
(740) 587-0114
www.ravensfield.com
From | Date | Subject | |
---|---|---|---|
Next Message | Julie May | 2003-11-17 17:55:27 | Re: Move a table to another schema |
Previous Message | Steve - DND | 2003-11-17 17:31:37 | MultiByte Columns? |