shlomi-noach / openarkkit

Automatically exported from code.google.com/p/openarkkit
24 stars 16 forks source link

Incorrect unique key column count reported for tables with >1 unique keys #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Relevant file: oak-online-alter-table

In the function "get_shared_unique_key_columns", variables "unique_key_type" 
and "unique_key_column_names" are assigned a value at most twice: once to None 
(lines 196, 197), and again inside the if block on line 208. The remaining 
variable in the returned tuple, "count_columns_in_unique_key", is assigned a 
value outside of said if block. It will be assigned a value as many times as 
there are items in the Set "shared_unique_key_column_names_set". For tables 
with multiple unique keys of different column counts, it is possible for 
"count_columns_in_unique_key" to hold the column count for a unique key other 
than the one found in "unique_key_column_names".

This discrepancy can cause an error in the function "get_unique_key_range", 
when attempting to assign N columns to M variables, where N != M.

A diff that corrects this is attached.

-Stephen

Original issue reported on code.google.com by xALT...@gmail.com on 29 Jun 2010 at 12:36

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in r122 (not yet released, please see trunk).

Thank you for this bug report as well as suggested fix. Your fix appears to be 
correct, yet I confess I have not tested it thoroughly (apparently I have not 
tested thoroughly the code before the fix ;) ).

Original comment by shlomi.n...@gmail.com on 30 Jun 2010 at 5:38