[erlang-bugs] ets:match/1 and ets:select/1

Doug Edmunds <>
Wed Aug 29 23:38:08 CEST 2007


Problem with ets:match(continuation);
same problem with ets:select(continuation).

match/1, and select/1 only work with variables.

-- doug edmunds
I posted this yesterday, but it never showed up
and is not in the archives. Sorry if you receive
this twice.

29 August 2007


Example of bug:
%set up an ets table
A = ets:new(arf,[bag]),
ets:insert(A,[{frog,croak}, {duck,quack},
{cow, moo}, {dog, bark}, {dog,pluto}, {dog,tails},
{ dog,woof},{cat, meow},
{pig,oink},{chicken, cluck},
{rooster, cockadoodle}]).

%match/3
{D, E } = ets:match (A,{'$1','$2'},3 ).

E.
%% {15,103,3,<<>>,[[dog,bark],[dog,pluto]],2}

E == {15,103,3,<<>>,[[dog,bark],[dog,pluto]],2}.
%% true.

E =:= {15,103,3,<<>>,[[dog,bark],[dog,pluto]],2}.
%% true.

%continuation that works:
ets:match(E).
% {[[cow,moo],[dog,bark],[dog,pluto]],{15,132,3,<<>>,[],0}}

%bug: continuation that fails:
ets:match({15,103,3,<<>>,[[dog,bark],[dog,pluto]],2}).

produces this error report:

=ERROR REPORT==== 28-Aug-2007::07:33:08 ===
Error in process <0.30.0> with exit value:
{badarg,[{ets,match,[{15,103,3,<<0 by
tes>>,[[dog,bark],[dog,pluto]],2}]},{erl_eval,do_apply,5},{shell,exprs,6},{shell
,eval_loop,3}]}

** exited:
{badarg,[{ets,match,[{15,103,3,<<>>,[[dog,bark],[dog,pluto]],2}]},
                    {erl_eval,do_apply,5},
                    {shell,exprs,6},
                    {shell,eval_loop,3}]} **
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20070829/916e05fb/attachment.html>


More information about the erlang-bugs mailing list