On Monday, July 27, 2015 at 6:29:12 PM UTC-7, Karl He wrote:
>
> I ran into another related issue while fiddling with this: it is possible 
> to need a REORG in the middle of a single ALTER_TABLE statement.
>
> For example:
>
>       alter_table table do
>         set_column_allow_null new_col_name, false
>         add_index new_col_name, :unique => true
>       end
>
> This can of course be avoided by doing something like this:
>
>       alter_table table do
>         set_column_allow_null new_col_name, false
>       end
>       alter_table table do
>         add_index new_col_name, :unique => true
>       end
>
> Which isn't ideal. To fix this maybe we can rescue it and REORG like is 
> currently done on `table_exists?`, with some smarter logic to remove the 
> potential for infinite retrying (allowing for only 1 retry won't always 
> work in this case). Or maybe use something like REORGCHK. If the goal is 
> only to make migrations work the same as other DBs, the former is probably 
> fine.
>

This should be possible to fix.  I don't believe Sequel tries to combine 
multiple ALTER TABLE queries into a single query on DB2, so instead of 
doing the REORG check around all queries, it should be done around each 
query.  Moving the reorg command from alter_table to the loop inside 
apply_alter_table should handle that.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to