Re: Object movement

From: Daulat <daulat(dot)dba(at)gmail(dot)com>
To: Holger Jakobs <holger(at)jakobs(dot)com>
Cc: pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Object movement
Date: 2022-02-18 04:37:24
Message-ID: CALfOM6+bqyUVZEr6B1te9DvygiYAgxGrknRzb=J7YQBd03t=1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks Holger !
I think we can do it as below.

\c <database>
alter table all in tablespace tbs1 set tablespace tbs2;
select schemaname,tablename,tablespace,tableowner from pg_tables where
tablespace=' tbs2';

On Wed, Feb 16, 2022 at 2:10 PM Holger Jakobs <holger(at)jakobs(dot)com> wrote:

> Am 16.02.22 um 09:36 schrieb Daulat:
> > Hello,
> >
> > How can we move the object (tables etc.) of one database from another
> > tablespace in postgres?
> >
> > Thanks
>
> Move an object to a new tablespace:
>
> ALTER objectName SET TABLESPACE newTablespace
>
>
> You cannot move an object to a new database. You would have to re-create
> it there.
>
> --
> Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Yoong S. Chow 2022-02-18 05:17:39 pg_upgrade from Postgresql-12 to Postgresql-13 fails with "Creating dump of database schemas postgres *failure*"
Previous Message Thomas Kellerer 2022-02-16 13:42:28 Re: Differential backup in database migration