pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Object movement
3+ messages / 2 participants
[nested] [flat]

* Object movement
@ 2022-02-16 08:36  Daulat <daulat.dba@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Daulat @ 2022-02-16 08:36 UTC (permalink / raw)
  To: pgsql-admin <pgsql-admin@lists.postgresql.org>

Hello,

How can we move the object (tables etc.) of one database from another
tablespace in postgres?

Thanks

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Object movement
@ 2022-02-16 08:40  Holger Jakobs <holger@jakobs.com>
  parent: Daulat <daulat.dba@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Holger Jakobs @ 2022-02-16 08:40 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

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



Attachments:

  OpenPGP_signature (application/pgp-signature, 202B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Object movement
@ 2022-02-18 04:37  Daulat <daulat.dba@gmail.com>
  parent: Holger Jakobs <holger@jakobs.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Daulat @ 2022-02-18 04:37 UTC (permalink / raw)
  To: Holger Jakobs <holger@jakobs.com>; +Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>

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@jakobs.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
>
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-02-18 04:37 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 08:36 Object movement Daulat <daulat.dba@gmail.com>
2022-02-16 08:40 ` Holger Jakobs <holger@jakobs.com>
2022-02-18 04:37   ` Daulat <daulat.dba@gmail.com>

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