Re: clone_schema function - Mailing list pgsql-general

From Melvin Davidson
Subject Re: clone_schema function
Date
Msg-id CANu8FizuTn74i7b==E=OvTOegL2NCs5wMT_2GW400k0hsaihVA@mail.gmail.com
Whole thread Raw
In response to Re: clone_schema function  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: clone_schema function
List pgsql-general
David,

Yes, it would be nice, but
1. I am still working also on bringing over the comments for various objects
2. What you request is currently beyond my capability. Not to mention that there already
    are existing tools that do that, albeit they are not free.

On Tue, Sep 15, 2015 at 12:27 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
To make the casual user's life easier, in the face of this reality, it would nice if the routine would generate a reasonably attempted "diff" between the two so that all changes can be reviewed in a structured manner aided by correctly configured tools and advice.

On Tue, Sep 15, 2015 at 12:20 PM, Melvin Davidson <melvin6925@gmail.com> wrote:
Igor,
I understand your point, however, I have spent over a week making a function
that previously did very little do a lot.
Naming a table the same as a schema is a very silly idea.

Unless you care to take the time to provide a full
schema, and function that fails for reasonable , practical design
I will ignore all further comments.

On Tue, Sep 15, 2015 at 9:55 AM, Igor Neyman <ineyman@perceptron.com> wrote:

 

That is correct. But table old will NOT be converted to new because

only the schema name is converted. And table "old" WILL exist because it will also be copied.

I have tested and it works properly.

Please do not provide hypothetical examples. Give me an actual working example that causes the problem.

This statement:

SELECT old.field FROM old.old;

selects column “field” from table “old” which is in schema “old”.

Your script converts it into:

SELECT new.field FROM new.old

which will try to select column “field” from table “old” in schema “new”.

 

Again:

SELECT new.field

means select column “field” from table “new”, which does not exists.

Not sure, what other example you need.

Regards,

Igor Neyman




--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.





--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: clone_schema function
Next
From: Alvaro Herrera
Date:
Subject: Re: BDR truncate and replication sets