Got {aborted,{no_exists,pdpcontext}} with Mnesia
Jan Chochol
jan.chochol@REDACTED
Thu Jul 16 11:35:08 CEST 2020
Your call to "mnesia:create_table" fails with
"{aborted,{bad_type,pdpcontext,disc_copies,nonode@REDACTED}}" (you are
not checking return value, so it is hard to spot).
For disc copies you need create schema first, so something like:
database_initialize() ->
ok = mnesia:create_schema([node()]),
ok = mnesia:start(),
{atomic, ok} = mnesia:create_table(
pdpcontext, [{disc_copies, [node()]}, {attributes, record_info(fields,
pdpcontext)}]
),
mnesia:stop().
Also "mnesia:create_schema/1" fails with something like
"{error,{_,{already_exists,_}}}", when schema already exists (you need
to count with it in code).
Regards,
Jan
On Thu, Jul 16, 2020 at 11:19 AM Dániel Szoboszlay
<dszoboszlay@REDACTED> wrote:
>
> The error suggests you're trying to read or write a table called pdpcontext which doesn't exist. Maybe you forgot to create it?
>
> Cheers,
> Daniel
>
> On Thu, 16 Jul 2020 at 10:24, Papa Tana <papa.tana101@REDACTED> wrote:
>>
>> Hi All,
>>
>> I want to use Mnesia for my application, but it returns "no_exists"
>>
>> According to the documentation:
>>
>> ==> no_exists: Tried to perform operation on non-existing (non-alive) item.
>>
>> $ dialyzer first.erl
>> Checking whether the PLT c:/Users/Lova/.dialyzer_plt is up-to-date... yes
>> Proceeding with analysis... done in 0m0.23s
>> done (passed successfully)
>>
>>
>> $ erl -sname myggsn@REDACTED
>> Eshell V11.0 (abort with ^G)
>>
>> (myggsn@REDACTED)1> c(first).
>> {ok,first}
>>
>> (myggsn@REDACTED)2> node().
>> myggsn@REDACTED
>>
>> (myggsn@REDACTED)3> mnesia:start().
>> ok
>>
>> (myggsn@REDACTED)4> first:database_initialize().
>> =INFO REPORT==== 16-Jul-2020::11:12:13.951000 ===
>> application: mnesia
>> exited: stopped
>> type: temporary
>>
>> stopped
>>
>> (myggsn@REDACTED)5> first:start().
>> {aborted,{no_exists,pdpcontext}}
>>
>> Where am I wrong please?
>>
>> I send enclosed my first.erl
>>
>> Best Regards,
More information about the erlang-questions
mailing list