Mnesia schema transaction: Checking if a table exists

Rudolph van Graan rvg@REDACTED
Thu Mar 4 15:13:09 CET 2004


Hi again,

Thanks for the information - I can now create tables in a transaction. 
However, this leads to the next problem...

I am busy creating say 10 tables... As part of my creation script, I 
need to check if another table exists, so I made a function like this 
one:

table_exists(TableName) ->
   Tables = mnesia:system_info(tables),
   lists:member(TableName,Tables).

This works fine if I use it outside the schema_transaction for a table 
that has just been created. If I use it inside the schema_transaction, 
on a table that has just been created in the same transaction, it 
fails... Is there some other function I can use to check for a table 
that has just been created in the same function and that will query the 
changes for the current transaction instead? [The idea is that the 
transaction must abort and all the changes rolled back if something 
goes wrong here]. I.e. if I do create_table(), and immediately run this 
function afterwards, it must return true while inside the schema 
transaction.

Regards.

Rudolph van Graan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2112 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20040304/6f0b6d72/attachment.bin>


More information about the erlang-questions mailing list