mnesia:transform_table - index handling bug?
Peter L
erlang@REDACTED
Fri Jan 14 14:42:36 CET 2005
Actually if you load the new code before you run the 3 statements
the first would not work. I guess the first line has be rewritten
to explicitly delete index number 6 to get it right:
mnesia:del_table_index(mytable,6),
mnesia:transform_table(mytable,UpgradeTableFun,NewAttrList),
mnesia:add_table_index(mytable,myindexattribute),
(Remember now that I did this index position switch *manually* after
the table upgrade and then I could only use numbers running R9C)
/Peter
> I wrote:
>
> Been trying to "soft upgrade" my mnesia tables with
mnesia:transform_table/3.
>
> I had an extra index 'myindexattribute' at position 6 and then I added a
new
> normal non-indexed attribute in position 3, meaning that 'myindexattribute'
> at position 6 moved to position 7 in the new mnesia table.
>
> But the transform_table/3 did NOT move the extra index to the new
position of
> 'myindexattribute' (6->7). In order to get it to upgraded properly
(including
> correct movement of the extra index), I was forced to do 3 statements
instead of one:
>
> mnesia:del_table_index(mytable,myindexattribute),
> mnesia:transform_table(mytable,UpgradeTableFun,NewAttrList),
> mnesia:add_table_index(mytable,myindexattribute),
>
> I would say that that is a bug! Wouldn't you? At least this behaviour is
not
> documented. Or is there a better (more beautiful) way to get the same thing
> done?
>
> --
> Peter Lund
> Web: http://lundata.se
> Tel: +46 70 543 9416
More information about the erlang-questions
mailing list