Re: clone_schema function

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: 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:23:47
Message-ID: CANu8FizoJ0B7GHTwxH8gAcjXfhgkshUmT=GMX5rPO=h94526zQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"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>
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
>

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igor Neyman 2015-09-11 20:34:12 Re: clone_schema function
Previous Message Daniel Verite 2015-09-11 20:06:45 Re: clone_schema function