From: Guillaume Lelarge <guillaume@lelarge.info>
To: Richard Shaw <richard@aggress.net>
Cc: pgsql-admin@postgresql.org
Subject: Re: Moving database and schema to a new tablespace
Date: Thu, 08 Sep 2011 20:55:27 +0200
Message-ID: <1315508127.3556.35.camel@localhost.localdomain> (raw)
In-Reply-To: <9BD8BDB8-C1D6-4683-8011-95C0E66F3AAB@aggress.net>
References: <9BD8BDB8-C1D6-4683-8011-95C0E66F3AAB@aggress.net>
On Thu, 2011-09-08 at 19:09 +0100, Richard Shaw wrote:
> Hi,
>
> I'm looking to move a database by using ALTER DATABASE $DB SET TABLESPACE and i'd also like to move a schema over to the same new tablespace, googling around, it looks like there was a an ALTER SCHEMA $SCHEMA SET TABLESPACE command in the past, but apparently no longer. I'm using Postgres 9, can anyone confirm if this is still possible, and if not, how I can move the schema over ?
>
ALTER SCHEMA... SET TABLESPACE never existed in PostgreSQL.
As you're using PostgreSQL 9, you can use the DO command to do something
like this. You need to find every table in the schema, and launch ALTER
TABLE... SET TABLESPACE to them. And then do the same with indexes.
--
Guillaume
http://blog.guillaume.lelarge.infohttp://www.dalibo.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: guillaume@lelarge.info, richard@aggress.net
Subject: Re: Moving database and schema to a new tablespace
In-Reply-To: <1315508127.3556.35.camel@localhost.localdomain>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox