Mnesia odd behaviour - delete_object
Chandrashekhar Mullaparthi
Chandrashekhar.Mullaparthi@REDACTED
Tue Oct 30 14:43:42 CET 2001
Looks like a bug. When the attributes are not specified during table
creation, it assumes [key, val]. Interestingly, this problem seems to occur
only when the value for key is 'key'. I tried F1 with {a, key1, [1,2]} and
delete_object works fine.
This seems to point that the problem is in the function
erlang:db_match_erase/2
> -----Original Message-----
> From: Martin Bjorklund [mailto:mbj@REDACTED]
> Sent: 30 October 2001 12:50
> To: erlang-questions@REDACTED
> Subject: Mnesia odd behaviour - delete_object
>
>
> I've got a funny mnesia situation. The problem is delete_object
> vs. delete.
>
> I've got a simple 'set' table a:
>
> mnesia:create_table(a, []).
>
> Add an object:
>
> mnesia:dirty_write({a, key, [1,2]}).
>
> Now, I've got this fun:
>
> F1 = fun() ->
> mnesia:write({a, key, [1]}), % modify the one&only object
> [X] = mnesia:read({a, key}), % read it
> mnesia:delete_object(X) % delete the one&only object
> end.
>
> After executing F1 within a transaction, my table still contains the
> original object. Since 'a' is a set, I'd think that the object would
> be removed.
>
> After executing F1 'async_dirty', the object is removed.
>
>
> F2 = fun() ->
> mnesia:write({a, key, [1]}), % modify the one&only object
> mnesia:delete({a, key}) % delete the one&only object
> end.
>
> After executing F2 within a transaction, the object is removed.
>
>
> Can someone explain this behaviour??
>
>
> I've tested on mnesia 3.9.2 and 4.0. It's probably not a bug, but I
> cannot come up with a interpretation that feels consistent...
>
>
>
> /martin
>
NOTICE AND DISCLAIMER:
This email (including attachments) is confidential. If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents. We cannot accept liability for any breaches of
confidence arising through use of email. Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions. We will not accept responsibility for any commitments
made by our employees outside the scope of our business. We do not warrant
the accuracy or completeness of such information.
More information about the erlang-questions
mailing list