From: | Igor Neyman <ineyman(at)perceptron(dot)com> |
---|---|
To: | Melvin Davidson <melvin6925(at)gmail(dot)com>, Daniel Verite <daniel(at)manitou-mail(dot)org> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: clone_schema function |
Date: | 2015-09-11 20:34:12 |
Message-ID: | A76B25F2823E954C9E45E32FA49D70ECCD5158B2@mail.corp.perceptron.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Melvin Davidson
Sent: Friday, September 11, 2015 4:24 PM
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] clone_schema function
"seriously flawed" is a bit of a stretch. Most sane developers would not have schema names of one letter.
They usually name a schema something practical, which totally avoids your nit picky exception.
However, if you are that concerned about the "serious flaw", you have the option of using the method
of dumping the schema, editing the dump and reloading. Or, I invite you to use your great skills and
write a better method.
On Fri, Sep 11, 2015 at 4:06 PM, Daniel Verite <daniel(at)manitou-mail(dot)org<mailto:daniel(at)manitou-mail(dot)org>> wrote:
Melvin Davidson wrote:
> I've added error checking and verified that it now copies the
> current sequnce values, table data, views and functions.
The code dealing with functions is seriously flawed.
Consider that part:
SELECT pg_get_functiondef(func_oid) INTO qry;
SELECT replace(qry, source_schema, dest_schema) INTO dest_qry;
EXECUTE dest_qry;
It suggests that to duplicate a function in schema A to B,
every letter A in the entire function definition should be replaced
by B, garbling everything along the way.
For example CREATE FUNCTION would become CREBTE FUNCTION,
DECLARE would become DECLBRE and so on.
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite
____________________________________________________
It does not have to be one-letter schema name.
Consider the following:
Schema called “vector” has a table called “vector_config” referenced in some function.
Now, what happens if schema “vector” is copied into some destination schema using your script?
Melvin, you needn’t consider every critique of your script to be a personal attack on you.
Regards,
Igor Neyman
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2015-09-11 20:39:24 | Re: clone_schema function |
Previous Message | Melvin Davidson | 2015-09-11 20:23:47 | Re: clone_schema function |