[erlang-bugs] Bug in qlc

Daniel Luna <>
Fri Dec 1 14:28:34 CET 2006


I'm wasting a really good obfuscated Erlang contribution here...

See code below.

qlc "A" works if you remove ", true".

Both work if you remove disc_only_copies.

This error occurs in R11B-2, but not in R11B-1.

/Daniel Luna

%% -*- erlang-indent-level: 2 -*-
-module(qlc_bug).
-compile(export_all).

-include_lib("stdlib/include/qlc.hrl").

provoke_error()->
   application:set_env(mnesia,dir,"/tmp/"),
   mnesia:create_schema([node()]),
   ok = mnesia:start(),
   case mnesia:create_table(blah,
                            [{disc_only_copies,[node()]},
                             {type,set}]) of
     {atomic,ok} -> ok; {aborted,{already_exists,blah}} -> ok
   end,

   A= qlc:q([F || F <-mnesia:table(blah), (F band ((1 bsl 0)) =/= 0), true]),
   {atomic,Result} = mnesia:transaction(fun() -> qlc:eval(A)end),
   case is_list(Result) of
     true -> io:format("List~n",[]);
     false -> io:format("This should not happen!~nResult = ~p~n",[Result])
   end,

   B = qlc:q(["" || I <- mnesia:table(blah), any:function_call(I)]),
   {atomic,BR} = mnesia:transaction(fun()->qlc:eval(B)end),
   case is_list(BR) of
     true -> io:format("List~n",[]);
     false -> io:format("This should not happen!~nResult = ~p~n",[BR])
   end.




More information about the erlang-bugs mailing list