OID as Primary Key
От | Jonas Bengtsson |
---|---|
Тема | OID as Primary Key |
Дата | |
Msg-id | 985264584.171jonas.b@home.se обсуждение исходный текст |
Ответы |
Re: OID as Primary Key
Re: OID as Primary Key |
Список | pgsql-general |
Hello, I have problems with using OID as PK. I have created a UNIQUE INDEX on the oid on a relation called CourseEvents. The relation that is supposed to have a FK to CourseEvents is CourseEventsForums and it has a field called ceid which has oid as dtatype. But when I try to create a FK to that table I get following error: --- PostgreSQL said: ERROR: UNIQUE constraint matching given keys for referenced table "courseevents" not found Your query: ALTER TABLE CourseEventForums ADD CONSTRAINT RefCourseEvents43 FOREIGN KEY (ceid) REFERENCES CourseEvents(oid) --- What is wrong? Is it to prefer to use oid as PK? Or should I use SERIAL instead? I thought it might be more efficient to use oid and a waste of space to add another integer as PK. Thanks in advance, Jonas Bengtsson
В списке pgsql-general по дате отправления: