| From: | Jonas Bengtsson <jonas(dot)b(at)home(dot)se> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | OID as Primary Key |
| Date: | 2001-03-22 12:36:24 |
| Message-ID: | 985264584.171jonas.b@home.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Richard Huxton | 2001-03-22 12:50:15 | Re: after trigger question |
| Previous Message | Joel Burton | 2001-03-22 12:14:51 | String REPLACE function |