On Wednesday 04 October 2006 12:16, Ernie wrote:
I’m trying to save a record in Rails to a table that does not have a
primary key. Rails is trying to auto-increment the primary key for me -
but there isn’t one, so it throws an exception. Does anyone know how to
turn off auto-incrementing of primary keys - if at all possible?
What good is a table that has no primary key? In 20 years of designing
databases large and small I cannot recall a single case where it would
been appropriate having a table without primary key.
Just consider the following scenario: for some reason (eg programmatic
an identical record is inserted twice. You want to get rid of one copy.
Unless you use a backend that generates some sort of unique feature (eg
in PostgreSQL) you will find that you can’t.