From: | Melvin Davidson <melvin6925(at)gmail(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Daniel Verite <daniel(at)manitou-mail(dot)org>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: clone_schema function |
Date: | 2015-09-11 20:47:18 |
Message-ID: | CANu8FiyNoQSJ385Lj8+c748beSadz200x+GNqbVPB1hxCPmRMw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Igor & David,
You are correct, I am subject to criticism, However, I have spent a few
days getting this to work as it should and it now does.
Even though the chance of a collision is not zero, it is still low and the
function does work.
I don't mind criticism, but when someone finds a problem, the least they
can do is suggest a fix, as you have David.
I'll try that and test over the weekend.. Or I also invite you to submit a
fixed version.
On Fri, Sep 11, 2015 at 4:39 PM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> On Fri, Sep 11, 2015 at 4:23 PM, Melvin Davidson <melvin6925(at)gmail(dot)com>
> wrote:
>
>> "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.
>>
>>>
>>> SELECT replace(qry, source_schema, dest_schema) INTO dest_qry;
>>>
>>
> Or maybe you can at least mitigate the potential problem a bit by changing
> this to read:
>
> replace(qry, source_schema || '.', dest_schema || '.') INTO dest_qry; ...
>
> Posting code for public consumption involves accepting constructive
> criticism and even if the example is contrived I'm doubting the possibility
> of collision is as close to zero as you think it may be or as close as it
> could be with a simple re-evaluation of what constraints as imposed on a
> particular sequence of characters being interpreted as a schema. You do
> still end up with a possible false-positive when you have a
> (column.composite).composite_field expression.
>
> Regular expressions could maybe help here since the leading character is
> limited too...but less so then the trailing character.
>
> David J.
>
>
>
--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
From | Date | Subject | |
---|---|---|---|
Next Message | Charles Lynch | 2015-09-11 21:21:41 | BDR problem |
Previous Message | David G. Johnston | 2015-09-11 20:39:24 | Re: clone_schema function |