[erlang-questions] mnesia tables with few attributes

Andras Georgy Bekes <>
Wed Dec 12 15:36:54 CET 2007


Hi,

It seems that mnesia has a rather strange restriction:
"The table must have at least one extra attribute in addition to the 
key."

Ok, in general mnesia tables hold records, so a record has a name, and a 
record contains at least two values. If you have only one value, why 
would you need a record? --- This is logical.

But, what if I only want a 'set' --- a set in the mathematical sense, I 
just want to have elements, insert and remove them, check for 
membership, etc. And I need persistence and transactions... Do I really 
need 2 extra fields besides the key (the only value I need)?

Is there some real reason why a table with 1 or 2 columns are 
prohibited, or just because it's use is... illogical?

Any idea to (ab)use mnesia to implement a 'set'?

	Georgy

PS: OK, I can make a table with 2 extra fields, it isn't performance or 
space critical, just ugly :-)



More information about the erlang-questions mailing list