[erlang-questions] Fwd: Can't create schema in Mnesia

Bob Ippolito <>
Mon Jan 20 03:22:33 CET 2014


If you use a fully qualified M:F(A) style call, then the compiler won't try
and verify that it exists.

1> fun () -> x:this_definitely_does_not_exist() end.
#Fun<erl_eval.20.80484245>

To have the compiler ignore whether a function is used or not, you can use
-compile(export_all). This should really only be enabled sparingly during
development (and perhaps conditionally compiled in for tests).


On Sun, Jan 19, 2014 at 6:12 PM, Yves S. Garret
<>wrote:

> I know that this is somewhat on a tangent, but if someone could please
> answer this question, I'd really appreciate it.
>
>
> "Also, I have an another question.  Lets say I'm testing some code and I
> comment out where I'm calling a function (located in the same file.)  How
> can I tell the compiler to not worry about this file not being called?  I
> know I can for variables such as _Variable, but methods?"
>
> Is that even possible?
>
>
> On Sat, Jan 18, 2014 at 10:37 PM, Bob Ippolito <> wrote:
>
>> I think you should check again, I believe you have made a mistake. You
>> will only get this error and see that output if you have a mnesia.beam on
>> the code path that is not the one that ships with Erlang. Having only a
>> setup/0 export makes it extremely likely that this is the original
>> mnesia.beam that would be produced from the mnesia.erl that you pasted
>> earlier in this thread.
>>
>> Try evaluating code:which(mnesia). If it doesn't show the same directory
>> as code:which(mnesia_locker) then you will know which beam file to delete.
>>
>>
>>  On Sat, Jan 18, 2014 at 7:05 PM, Yves S. Garret <
>> > wrote:
>>
>>>  @ Bob Ippolito, I tried that, the same result, the same error as
>>> described previously.
>>>
>>> ---------- Forwarded message ----------
>>> From: Yves S. Garret <>
>>>  Date: Sat, Jan 18, 2014 at 10:03 PM
>>> Subject: Fwd: [erlang-questions] Can't create schema in Mnesia
>>> To: "" <>
>>>
>>>
>>> @ *Ludovic Demblans, sure.*
>>>
>>> 29> rp(lists:sort(mnesia:module_info(exports))).
>>> [{module_info,0},{module_info,1},{setup,0}]
>>> ok
>>>
>>>
>>> ---------- Forwarded message ----------
>>> From: Yves S. Garret <>
>>> Date: Sat, Jan 18, 2014 at 9:35 PM
>>> Subject: Re: [erlang-questions] Can't create schema in Mnesia
>>> To: Bob Ippolito <>
>>> Cc: "" <>
>>>
>>>
>>> Done, no change:
>>>
>>> 19> c(mnes).
>>> {ok,mnes}
>>> 20> rr("records.hrl").
>>> [planemo,tower]
>>> 21> mnes:setup().
>>>
>>> ** exception error: undefined function mnesia:create_schema/1
>>>       in function  mnes:setup/0 (mnes.erl, line 24)
>>>
>>> Here is records.hrl:
>>> http://bin.cakephp.org/view/1897069453
>>>
>>>
>>> On Sat, Jan 18, 2014 at 9:32 PM, Bob Ippolito <> wrote:
>>>
>>>> Rename the module to something other than mnesia, there's a flat module
>>>> namespace and only one module named mnesia can be loaded at a time.
>>>>
>>>>
>>>> On Saturday, January 18, 2014, Yves S. Garret <
>>>> > wrote:
>>>>
>>>>> Hello all,
>>>>>
>>>>> I have the following code:
>>>>> http://bin.cakephp.org/view/2135184996
>>>>>
>>>>> When I compile and reload the records, this is what happens:
>>>>>
>>>>> 14> c(mnesia).
>>>>> {ok,mnesia}
>>>>> 15> rr("records.hrl").
>>>>> [planemo,tower]
>>>>> 16> mnesia:setup().
>>>>> ** exception error: undefined function mnesia:create_schema/1
>>>>>      in function  mnesia:setup/0 (mnesia.erl, line 25)
>>>>>
>>>>> The function _does_ exist in the mnesia module.  I checked the docs
>>>>> and I'm running 16B03, so it's there.  But why this error?
>>>>>
>>>>> Also, I have an another question.  Lets say I'm testing some code and
>>>>> I comment out where I'm calling a function (located in the same file.)  How
>>>>> can I tell the compiler to not worry about this file not being called?  I
>>>>> know I can for variables such as _Variable, but methods?
>>>>>
>>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140119/c4d45d32/attachment.html>


More information about the erlang-questions mailing list