moving database objects from one schema to other

Started by akp geekover 15 years ago4 messagesgeneral
Jump to latest
#1akp geek
akpgeek@gmail.com

Hi all -

I would like to know if there is any other way of moving
objects from one schema to other schema? right now the way I am doing it is
, take the backup and importing whatever the database objects I wanted to
move, I am doing that using pg_restore. But I am finding it difficult for
functions, sequences

Thanks for your help

Regards

#2Thom Brown
thom@linux.com
In reply to: akp geek (#1)
Re: moving database objects from one schema to other

On 28 October 2010 17:11, akp geek <akpgeek@gmail.com> wrote:

Hi all -
              I would like to know if there is any other way of moving
objects from one schema to other schema? right now the way I am doing it is
, take the backup and importing whatever the database objects I wanted to
move, I am doing that using pg_restore. But I am finding it difficult for
functions, sequences
Thanks for your help
Regards

Yes, you just need to assign a new schema:

ALTER TABLE table_name SET SCHEMA new_schema;
ALTER FUCNTION function_name SET SCHEMA new_schema;

etc...

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: akp geek (#1)
Re: moving database objects from one schema to other

2010/10/28 akp geek <akpgeek@gmail.com>:

Hi all -
              I would like to know if there is any other way of moving
objects from one schema to other schema? right now the way I am doing it is
, take the backup and importing whatever the database objects I wanted to
move, I am doing that using pg_restore. But I am finding it difficult for
functions, sequences
Thanks for your help
Regards

hello

use a statement: ALTER TABLE tablename SET SCHEMA new_schema

Regards

Pavel Stehule

#4akp geek
akpgeek@gmail.com
In reply to: Pavel Stehule (#3)
Re: moving database objects from one schema to other

Thanks a lot.

Regards

On Thu, Oct 28, 2010 at 12:23 PM, Pavel Stehule <pavel.stehule@gmail.com>wrote:

Show quoted text

2010/10/28 akp geek <akpgeek@gmail.com>:

Hi all -
I would like to know if there is any other way of moving
objects from one schema to other schema? right now the way I am doing it

is

, take the backup and importing whatever the database objects I wanted to
move, I am doing that using pg_restore. But I am finding it difficult for
functions, sequences
Thanks for your help
Regards

hello

use a statement: ALTER TABLE tablename SET SCHEMA new_schema

Regards

Pavel Stehule