First off, I'm about to snap. I'm at wits end trying to figure this out so in a last attempt, I am throwing myself at the mercy of the community.
Ok, I've got a table with a field called course_id. The values in this field need to match up with a primary key in another field, so naturally I have set this column up as a foreign key. Here's the constraint definition:
Code: Select all
Foreign Key constraints: $1 FOREIGN KEY (course_id) REFERENCES courses(course_id) ON UPDATE NO ACTION ON DELETE NO ACTION,
$2 FOREIGN KEY (questionnaire_id) REFERENCES questionnaire(questionnaire_id) ON UPDATE NO ACTION ON DELETE NO ACTIONWarning: pg_query(): Query failed: ERROR: Cannot insert a duplicate key into unique index questionnaire_taken_course_id_key ..
I also have indices set up on this table, although I haven't done it - I think postgres did when I made the foreign key constraints.
Code: Select all
questionnaire_taken_pkey primary key btree (questionnaire_taken_id),
questionnaire_taken_course_id_key unique btree (course_id)Cannot drop index questionnaire_taken_course_id_key because constraint questionnaire_taken_course_id_key on table questionnaire_taken requires it
You may drop constraint questionnaire_taken_course_id_key on table questionnaire_taken instead
So, I tried to drop the foreign key, but I can't figure out how the heck to do that.
So, my problem is - I want to remove just the unique limitation on the second index. Any and all advice/help will be GREATLY appreciated.