ActiveRecord Save Primary Key Issue

Help!
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?

Thanks,
Ernie

Ernie wrote:

Help!
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?

Thanks,
Ernie

Anybody???

On Wednesday 04 October 2006 12:16, Ernie wrote:

Help!
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?

Thanks,
Ernie

Anybody???

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
have
been appropriate having a table without primary key.

Just consider the following scenario: for some reason (eg programmatic
error)
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
OID
in PostgreSQL) you will find that you can’t.

Horst

Oracle Applications does not use referential integrity amongst its
tables, for one. The overhead for RI in some cases can be…excessive.
Which is one thing, in an odd way, that probably helps MySQL be a
tolerable DBMS behind applications, despite its deficiencies and
warts. Most web app developers seem to implement and enforce RI in
their applications…

Horst H. wrote:

On Wednesday 04 October 2006 12:16, Ernie wrote:

Help!
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?

Thanks,
Ernie

Anybody???

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
have
been appropriate having a table without primary key.

Just consider the following scenario: for some reason (eg programmatic
error)
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
OID
in PostgreSQL) you will find that you can’t.

Horst

I know I know…I completely agree with all of you. I’m working with a
legacy db, and they want to try to stay away from modifying db that is
in production.

Thanks again,
Ernie

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs