Schema Copy

Started by Sonam Sharmaover 6 years ago6 messagesgeneral
Jump to latest
#1Sonam Sharma
sonams1209@gmail.com

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?

#2Justin
zzzzz.graf@gmail.com
In reply to: Sonam Sharma (#1)
Re: Schema Copy

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@gmail.com> wrote:

Show quoted text

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?

#3Sonam Sharma
sonams1209@gmail.com
In reply to: Justin (#2)
Re: Schema Copy

Hi Justin,

What can be done to move the data..

On Thu, Dec 5, 2019, 7:57 PM Justin <zzzzz.graf@gmail.com> wrote:

Show quoted text

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@gmail.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?

#4Justin
zzzzz.graf@gmail.com
In reply to: Sonam Sharma (#3)
Re: Schema Copy

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@gmail.com> wrote:

Show quoted text

Hi Justin,

What can be done to move the data..

On Thu, Dec 5, 2019, 7:57 PM Justin <zzzzz.graf@gmail.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@gmail.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?

#5Melvin Davidson
melvin6925@gmail.com
In reply to: Justin (#4)
Re: Schema Copy

Can someone please help in schema copy in same database ?

A while ago, I created the clone_schema function which will duplicate one
schema to a new schema with the option to copy or not copy data. However,
since there are two versions depending on the version of PostgreSQL you are
using, and you have not specified which version of PostgreSQL you have, I
cannot help you at this time.

On Thu, Dec 5, 2019 at 9:37 AM Justin <zzzzz.graf@gmail.com> wrote:

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@gmail.com> wrote:

Hi Justin,

What can be done to move the data..

On Thu, Dec 5, 2019, 7:57 PM Justin <zzzzz.graf@gmail.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@gmail.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?

--
*Melvin Davidson*
*Maj. Database & Exploration Specialist*
*Universe Exploration Command – UXC*
Employment by invitation only!

#6Sonam Sharma
sonams1209@gmail.com
In reply to: Melvin Davidson (#5)
Re: Schema Copy

The version, I am using is 11.2

On Thu, Dec 5, 2019, 9:29 PM Melvin Davidson <melvin6925@gmail.com> wrote:

Show quoted text

Can someone please help in schema copy in same database ?

A while ago, I created the clone_schema function which will duplicate one
schema to a new schema with the option to copy or not copy data. However,
since there are two versions depending on the version of PostgreSQL you are
using, and you have not specified which version of PostgreSQL you have, I
cannot help you at this time.

On Thu, Dec 5, 2019 at 9:37 AM Justin <zzzzz.graf@gmail.com> wrote:

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@gmail.com> wrote:

Hi Justin,

What can be done to move the data..

On Thu, Dec 5, 2019, 7:57 PM Justin <zzzzz.graf@gmail.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@gmail.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?

--
*Melvin Davidson*
*Maj. Database & Exploration Specialist*
*Universe Exploration Command – UXC*
Employment by invitation only!