The documentation says:
"Fills an already created ETS table with the objects in the
already opened DETS table named DetsTab. The ETS table is
emptied before the objects are inserted."
However it doesn't clear the existing table at all:
1> dets:open_file(foo, []).
{ok,foo}
2>
2> dets:insert(foo, [{X,random:uniform(1000)}||X<-lists:seq(1,10)]).
ok
3> dets:info(foo, size).
10
4> ets:new(foo, [named_table]).
foo
5> ets:insert(foo, [{X,random:uniform(1000)}||X<-lists:seq(1,20)]).
true
6> ets:info(foo, size).
20
7> ets:from_dets(foo, foo).
true
8> ets:info(foo, size).
20
The last line shows that the ets table size is still 20, the size
of the initial insert, and not the size of the dets file which is
10. Inspecting the ets tables I see that after ets:from_dets/2
the first 10 objects have been replaced with the new values but
the last ten objects are still there from the first ets:insert/2.
-Vance