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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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, > ErnieAnybody??? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Horst Herb 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. > > HorstI 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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... On 10/4/06, Horst Herb <subscriptions-p8gy+/RydDesTnJN9+BGXg@public.gmane.org> 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 > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---