Thread: alter table schema on 8.0.X

alter table schema on 8.0.X

From
William Leite Araújo
Date:
     Hi, I'm trying alter a table schema on 'PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.5 (Debian 1:3.3.5-5)'.
     On 8.1, by documentation, has the commant "ALTER TABLE <table> SET SCHEMA <new_schema>". Any solution for this in 8.0?
    

Ps.: solutions different of "CREATE TABLE <new_schema.table> as SELECT * FROM schema.table" please.

--
William Leite Araújo

Re: alter table schema on 8.0.X

From
"Jim C. Nasby"
Date:
On Thu, Dec 01, 2005 at 10:25:48AM -0200, William Leite Ara?jo wrote:
>      Hi, I'm trying alter a table schema on 'PostgreSQL 8.0.2 on
> i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.5 (Debian 1:3.3.5-5)'.
>      On 8.1, by documentation, has the commant "ALTER TABLE <table> SET
> SCHEMA <new_schema>". Any solution for this in 8.0?
>
>
> Ps.: solutions different of "CREATE TABLE <new_schema.table> as SELECT *
> FROM schema.table" please.
>
> --
> William Leite Ara?jo

Theoretically, you can do this manually, but there's a number of things
you need to look at. Your best bet is to read through
AlterTableNamespace in
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c?rev=1.176
and see what it's doing.

It's always a bit dangerous mucking about with the system catalogs, so I
wouldn't recommend this for a production system.

If you do code up something that takes all those tables into account
it'd be good to share it with the community. If nothing else, one of the
core coders might tell you how risky it actually is.
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461