mnesia:create_table in transaction?

Ulf Wiger ulf.wiger@REDACTED
Sat Feb 7 10:00:34 CET 2004


On Fri, 6 Feb 2004 23:08:38 -0500, Shawn Pearce <spearce@REDACTED> 
wrote:

> Is the following not allowed?
>
> mnesia:transaction(fun() ->
> 	mnesia:create_table(....)
> end).
>
> as mnesia:create_table/2 is returning {aborted, nested_transaction}.
>
> I just thought I'd create all of my tables in a single transaction,
> in case one fails to create.  Apparently its not supported.
> Understandable, as very few databases allow table creation within
> transactions.  I just thought it was possible in Mnesia.

In mnesia_schema.erl, you will find some (undocumented) functions:

mnesia_schema:schema_transaction(
    fun() ->
       do_create_table(mnesia_schema:list2cs([{name,Name}|Opts])),
       ...
    end).


/Uffe
-- 
Ulf Wiger




More information about the erlang-questions mailing list