[erlang-questions] Mnesia and primary keys

Patrick Collison <>
Mon Jan 22 13:01:54 CET 2007


Hi,

I'm new to both Erlang and Mnesia, and having trouble wrapping my  
head around how Mnesia handles primary keys.

Suppose (in a RDBMS) I have two tables -- customers and orders. One  
customer may have many orders. Ordinarily, of course, this would be  
solved by having some a customer_id that each row in the order table  
references. Bog-standard stuff.

As far as I can see (from reading the documentation I can find),  
Mnesia doesn't assist you in any way in creating such primary keys  
(as PostgreSQL, Oracle, MySQL (and pretty much any other systems)  
do). Ensuring uniqueness, incrementing IDs, etc., seems to be left up  
to the application programmer.

Am I missing the correct, "Erlang-style" manner of implementing this  
kind of trivial cross-referencing, or am I unaware of facilities that  
Mnesia does actually provide?

Cheers,

-Patrick




More information about the erlang-questions mailing list