<div>HI:</div>
<div> </div>
<div>I have two tables :"user" and "product", I found the join query failed when one table is been transformed by function "mensia:transform_table". </div>
<div> </div>
<div>
<div>Here is the record defination:</div>
<div>-record(user,{uuid,name,version}).<br>-record(user2,{uuid,name}).<br>-record(product,{uuid,name,price,user}).</div></div>
<div> </div>
<div>The user table is first defined as the record "user", then is transformed by mensia:transform_table to the record "user2",after the transformation ,the join query on user table and product table failed and report badrecord exception.</div>
<div> </div>
<div>The related code lists as below.</div>
<div> </div>
<div>
<div>1.Here is the record defination:</div>
<div> </div>
<div>-record(user,{uuid,name,version}).<br>-record(user2,{uuid,name}).<br>-record(product,{uuid,name,price,user}).</div>
<div> </div>
<div>----------------------------------------------------------</div>
<div>2.here is the transform code:</div>
<div> </div>
<div>upgrade_fun(X)-><br> #user2{<br> uuid=X#user.uuid,<br> name=X#<a href="http://user.name">user.name</a><br> }.</div>
<div> </div>
<div>upgrade_table()-><br> <br> mnesia:transform_table(user,fun upgrade_fun/1,record_info(fields,user2),user2),<br> </div>
<div>--------------------------------------------------------------------</div></div>
<div>3. here is my QLC query code:</div>
<div> </div>
<div>q_product_6()-><br> do(qlc:q([{Y#user.uuid,Y#<a href="http://user.name">user.name</a>}||X<-mnesia:table(product),X#product.price<5,Y<-mnesia:table(<br>user),Y#user.uuid =< 6])).<br>do(Q) -><br> F = fun() -> qlc:e(Q) end,</div>
<div> Val= mnesia:transaction(F),<br> <br> Val.</div>
<div> </div>
<div> </div>
<div>The join query throw the exception:
<div> </div>
<div><br>** exception exit: {aborted,{{badrecord,user},<br> [{product,'-q_product_6/0-fun-1-',8},<br> {qlc,collect,1},<br> {qlc,eval,2},<br>
{mnesia_tm,apply_fun,3},<br> {mnesia_tm,execute_transaction,5},<br> {mnesia,wrap_trans,6},<br> {erl_eval,do_apply,5},<br>
{shell,exprs,6}]}}<br> in function mnesia:wrap_trans/6</div>
<div> </div>
<div>Any guys know why? It seems be a bug in QLC.</div></div>