[erlang-questions] deleting records from a ram_copies table in mnesia

Hakan Mattsson <>
Fri Feb 1 10:07:18 CET 2008


On Wed, 30 Jan 2008, Rick Pettit wrote:

RP> > I would like to delete some records froma ram_copies
RP> > table in mnesia, but the mnesia:delete({Tab,Key})
RP> > fails as the table doesn't exist on the disc...Is
RP> > there any workaround to use the ram table in mnesia
RP> > and delete the table or its records.
RP> 
RP> 
RP> Are you sure the table exists on the node you are calling mnesia:delete/1 on?
RP> 
RP> I suspect it doesn't exist on disc or in ram if you are getting a no_exists error.

You get no_exists when the table is not accessible on that node.
It may be several reasons for this:

  - The table does not exist (there is no such table in the
    local schema).

  - The table exists but is not yet readable at the local node.
    You should always invoke mnesia:wait_for_tables/2 in order
    to ensure that the table is accessible before you try to
    access it. Even if you do not have a local replica of the
    table you should use mnesia:wait_for_tables/2.
    
/Håkan


More information about the erlang-questions mailing list