primary key in mnesia

Hakan Mattsson hakan@REDACTED
Mon Jan 26 17:57:19 CET 2004

On Mon, 26 Jan 2004, Mohammad Reza Moosavi wrote:

Mohammad> How can I define a multi attribute primary key for a table?

You can't.

Mohammad> for example a table based on record f:
Mohammad> -record(f,{f1,f2,f3,f4}).
Mohammad> I want to have {f2,f3} as primary key, with no constraint on f1.

Instead you can have an arbritary complex Erlang term as primary key.

You need to redefine your record like:


in order to have {f2,f3} as primary key.


Håkan Mattsson
High Availability Software, DBMS Internals

More information about the erlang-questions mailing list