alter table schema in 8.0

From: Marcin Inkielman <marn(at)wsisiz(dot)edu(dot)pl>
To: pgsql-general(at)postgresql(dot)org
Subject: alter table schema in 8.0
Date: 2005-12-10 11:19:03
Message-ID: 439AB9A7.2000401@wsisiz.edu.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

I am migrating a relativly huge database from postgres 7.2 to 8.0. I
need to alter schema
for sth about 500 tables and twice as many other objects. Do I need to
sth other on a new database than:

create schema ... ;
update pg_class set relnamespace =$oid_of_new_schema where
relnamespace=$oid_of_old_schema;
update pg_proc set pronamespace =$oid_of_new_schema where
pronamespace=$oid_of_old_schema and not proname in(select a.proname from
pg_proc a, pg_proc b where a.pronamespace=$oid_of_new_schema and
b.pronamespace=$oid_of_old_schema and a.proname=b.proname);

where $oid_of_old_schema is the oid of the public namespace.

I didn't found any other reference to pg_catalog.pg_namespace.oid.
Did anybody try something like this?

I examined the sources of AlterTableNamespace() defined in tablecmds.c
but it wasn't realy helpful.
I will appreciate any help.

Best regards,

--
Marcin Inkielman

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Simon Riggs 2005-12-10 15:56:58 Re: random delays
Previous Message Jerry LeVan 2005-12-10 04:11:28 Re: Update and bytea problem...