Jared Camins-Esakov changed Bug 7065
What Removed Added
Status Needs Signoff Failed QA
CC   jcamins@cpbibliography.com

Comment # 2 from
We've discussed this on IRC, and have a few concerns. From IRC:

<@rangi> well theres one issue
<@rangi> you dont want auto_increment on old_reserves
< jcamins> Yeah, it's removed after the update.
<@rangi> hmmm
<@rangi> yeah i dont like it
< jcamins> I guess the proper way to do it is create a temporary table?
<@rangi> yes
<@rangi> and also, im not seeing where it changes the old_reserves
< jcamins> At the very end.
<@rangi> no
<@rangi> the update_sth
<@rangi> it does the same one twice
<@rangi> the 2 whiles
<@rangi> not changing renumbering old_reserves
<@rangi> or am i missing something
<@rangi> +    my $query = "UPDATE reserves SET reservenumber = ? WHERE 
         reservenumber = ?";
<@rangi> +    my $update_sth = $dbh->prepare( $query );
< jcamins> Oh, I see.
<@rangi> then it runs that updated_sth twice
<@rangi> so it just renumbers reserves twice
< jcamins> I think you are correct.
<@rangi> doesnt renumber old_reserves at all
...
< cait> so renumber them manually, first oldreserves then reserves?
<@rangi> that would work
< jcamins> It renumbers old_reserves at the beginning.
< jcamins> Using the ALTER TABLE.
<@rangi> hmm, that should definitely not do that
<@rangi> thats def a mysqlism
< jcamins> It also doesn't work properly.
<@rangi> yeah
< jcamins> It breaks the index.
<@rangi> yup
< jcamins> Somehow.
< jcamins> It's weird.
<@rangi> personally id renumber them with with a loop
<@rangi> old_reserves first, then reserves
< cait> makes sense
<@rangi> and id also make the column unique
< jcamins> That won't work either.
<@rangi> why not?
< cait> jcamins: why not?
< cait> lol
< jcamins> At least, as far as I can tell, adding a primary key leaves 
           the InnoDB indexes incorrect.
<@rangi> dont use auto_increment to number them, just select all, set the
         reservenumber
<@rangi> thats easy to fix
<@rangi> you just tell it to optimize the table
< jcamins> Ah.
<@rangi> the classy thing to do would be to do
<@rangi> if mysql
<@rangi> optimize reserves


You are receiving this mail because: