Re: How to "COPY schema1.table TO schema2.table" ?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Andreas Neumann <Andreas(dot)Neumann(at)em(dot)uni-karlsruhe(dot)de>
Cc: "Mike G(dot)" <mike(at)thegodshalls(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: How to "COPY schema1.table TO schema2.table" ?
Date: 2005-01-21 17:26:45
Message-ID: 20050121172645.GA58919@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, Jan 21, 2005 at 05:18:49PM +0100, Andreas Neumann wrote:

> Is there a convenient way to move a table (or a bunch of tables) to a
> different schema?

It might be possible by fiddling with the system catalogs, although
I haven't tried it myself.

I'm just brainstorming now, but you could update the table's
relnamespace column in pg_class. That alone probably wouldn't
suffice, however -- I'd also look for dependent objects in pg_depend,
pg_index, etc., and see if they needed to have columns updated as
well. Maybe somebody else can think of a complete list.

I see that the TODO list has the following item under ALTER:
"Allow objects to be moved to different schemas."

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Mike G. 2005-01-21 17:38:37 Re: How to "COPY schema1.table TO schema2.table" ?
Previous Message Sean Davis 2005-01-21 16:53:34 Re: generating dynamic queries using pl/pgsql