Question

something like unique column in sql. Any suggestion?

Was it helpful?

Solution

Your question is quite "open", so I tried to figure out what you want to do.

If you need to add a column which is not the primary key to store something like a unique ID, you can store there an erlang reference (Ref = make_ref()). which is almost guaranteed to be unique (cycle around 2^82). I don't know what is the behavior in multinode, but if there is a problem it is possible to tag the record with {node(),make_ref()}.

if you want create unique records by the combination of several keys: K1,K2,K3 you can use the tuple {K1,K2,K3} as key of the table and use a set or ordered set. but it will more complex to look into the table

if it it something else, some complementary information could help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top