This seems to be what you want: http://www.erlang.org/ml-archive/erlang-questions/200508/msg00291.html PS. Primary key is not exactly the same concept as "autoincrement" or "unique" key fields.