Is it possible to move a table from one schema to another (in the same
database)?

The only way I can think of is to:
- backup table
- modify backup file
- restore from modified backup
- delete original table

Is there a better/easier way?

Search Discussions

  • Sean Davis at Dec 3, 2008 at 2:13 am

    On Tue, Dec 2, 2008 at 8:55 PM, Frank Bax wrote:
    Is it possible to move a table from one schema to another (in the same database)?

    The only way I can think of is to:
    - backup table
    - modify backup file
    - restore from modified backup
    - delete original table

    Is there a better/easier way?
    ALTER TABLE name
    SET SCHEMA new_schema

    http://www.postgresql.org/docs/current/static/sql-altertable.html


    Hope that helps.

    Sean
  • Frank Bax at Dec 3, 2008 at 3:31 pm

    Sean Davis wrote:
    On Tue, Dec 2, 2008 at 8:55 PM, Frank Bax wrote:
    Is it possible to move a table from one schema to another (in the same database)?

    The only way I can think of is to:
    - backup table
    - modify backup file
    - restore from modified backup
    - delete original table

    Is there a better/easier way?
    ALTER TABLE name
    SET SCHEMA new_schema

    http://www.postgresql.org/docs/current/static/sql-altertable.html


    Hope that helps.

    Yes, very much so; thanks!

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedDec 3, '08 at 1:55a
activeDec 3, '08 at 3:31p
posts3
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Frank Bax: 2 posts Sean Davis: 1 post

People

Translate

site design / logo © 2022 Grokbase