[erlang-questions] aborted, bad_type when creating Mnesia disc only table

Nicolas Charpentier nc@REDACTED
Sun Apr 20 18:54:20 CEST 2008


Petr Sturc wrote:
> Hello,
> 
> beginners question - when doing
> 
> mnesia:create_table(order,[{disc_only_copies,
> [node()]},{attributes,[id,customerid,inputfile,creationdate,
> finisheddate, duedate, quantity]}])
> 
> I am getting error
> 
> {aborted,{bad_type,order,disc_only_copies,nonode@REDACTED}}
> 
> I am not able to spot the problem. Any idea?
> Thanks in advance,
> 

Hi,
I succeed to reproduce your problem.
You might have a problem with your schema.
As you want to create a disc_only_copies you have to tell mnesia where 
to store table on disc.
Basically, this is done with:
- a mnesia environement variable: mnesia dir. It's the location of your 
tables on disk.
- the schema creation: mnesia:create_schema/1.

Here are the command to create your table

$ erl -mnesia dir my_location
Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] 
[kernel-poll:false]

Eshell V5.5.5  (abort with ^G)
1> mnesia:create_schema([node()]).
ok
2> mnesia:start(). 
                                    ok 

3> 
mnesia:create_table(order,[{disc_copies,[node()]},{attributes,[id,customerid,inputfile,creationdate, 
finisheddate,duedate,quantity]}]).
{atomic,ok}
4>



Look at mnesia user's guide for my information about schema operations.
http://www.erlang.org/doc/apps/mnesia/part_frame.html


Regards,

Nicolas  Charpentier



More information about the erlang-questions mailing list