Re: Schema Copy

From: Justin <zzzzz(dot)graf(at)gmail(dot)com>
To: Sonam Sharma <sonams1209(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Schema Copy
Date: 2019-12-05 14:33:08
Message-ID: CALL-XeMU3VZHZ-hSn+xE-NHfWN7mRtsLEP3ovXGHxMM4H0uYFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Sonam

If you want a copy the data do a Select * into (newschema.table) from
oldschema.table https://www.postgresql.org/docs/9.1/sql-selectinto.html

If you want to just move the table

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

Alter Table oldschema.table Set Schema newschema

On Thu, Dec 5, 2019 at 9:31 AM Sonam Sharma <sonams1209(at)gmail(dot)com> wrote:

> Hi Justin,
>
> What can be done to move the data..
>
> On Thu, Dec 5, 2019, 7:57 PM Justin <zzzzz(dot)graf(at)gmail(dot)com> wrote:
>
>> Hi Sonam
>>
>> As long as the edited sql script has been changed from
>> oldschema.tables or oldschema.functions etc... to newschema.functions,
>> newschema.functios etc...
>>
>> This does not move data
>>
>> On Thu, Dec 5, 2019 at 5:07 AM Sonam Sharma <sonams1209(at)gmail(dot)com> wrote:
>>
>>> Can someone please help in schema copy in same database ?
>>>
>>> I have taken db dump of current schema and in the ddl file , I have
>>> edited it with new schema.
>>> Will this work?
>>>
>>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Zwettler Markus (OIZ) 2019-12-05 14:49:28 AW: secure deletion of archived logs
Previous Message Sonam Sharma 2019-12-05 14:30:56 Re: Schema Copy