Re: moving database objects from one schema to other

Lists: pgsql-general
From: akp geek <akpgeek(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: moving database objects from one schema to other
Date: 2010-10-28 16:11:39
Message-ID: AANLkTinDu0egEMaKbPTvpDkvb2dMyF+6dta=kk_aYtxA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

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


From: Thom Brown <thom(at)linux(dot)com>
To: akp geek <akpgeek(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: moving database objects from one schema to other
Date: 2010-10-28 16:15:58
Message-ID: AANLkTinN7x6JGUA0yv6O4vdMm0BWOahW0mOLFYRvJDz4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 28 October 2010 17:11, akp geek <akpgeek(at)gmail(dot)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


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: akp geek <akpgeek(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: moving database objects from one schema to other
Date: 2010-10-28 16:23:01
Message-ID: AANLkTim0q1XGQOrzetpf9aDpEs+HWEVa_k7GkNS9t7q_@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

2010/10/28 akp geek <akpgeek(at)gmail(dot)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


From: akp geek <akpgeek(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, thom(at)linux(dot)com
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: moving database objects from one schema to other
Date: 2010-10-28 16:59:40
Message-ID: AANLkTimWxQrYgnqjHm79WwWUteYsGYuM9F7B2omG3OKO@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Thanks a lot.

Regards

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

> 2010/10/28 akp geek <akpgeek(at)gmail(dot)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
>