Re: OID as Primary Key
От | Stephan Szabo |
---|---|
Тема | Re: OID as Primary Key |
Дата | |
Msg-id | Pine.BSF.4.21.0103220851220.41849-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | OID as Primary Key (Jonas Bengtsson <jonas.b@home.se>) |
Ответы |
RE: OID as Primary Key
|
Список | pgsql-general |
On Thu, 22 Mar 2001, Jonas Bengtsson wrote: > 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? The message is a bit misleading. Oid isn't a "user" column, and currently you can only create references to user columns. Given the issues involved with oid (since it's system wide it rolls over faster than a serial, you have to make sure to dump with oids, the fact that you have much less control over its value if you need to do something), I'm not 100% sure that's a bad thing, although IIRC references to oid are on the todo list.
В списке pgsql-general по дате отправления: