Re: FK question

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Igor Kryltsov <kryltsov(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: FK question
Date: 2004-08-28 00:25:15
Message-ID: 20040828002515.GA9819@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The second will allow combinations of (survey_id,employee_id) that are
not in employee_survey as long as the individual survey_id and
employee_id's exist. Whether that's a problem or not depends on your
schema....

On Thu, Aug 26, 2004 at 04:48:12PM +1000, Igor Kryltsov wrote:
> Hi,
>
> What is a difference, if any, between:
> _________________________________
> ALTER TABLE ONLY employee_role
> ADD CONSTRAINT fk_survey_id_employee_id FOREIGN KEY (survey_id,
> employee_id) REFERENCES employee_survey(survey_id, employee_id) MATCH FULL
> ON UPDATE C
> ASCADE ON DELETE CASCADE;
> __________________________________
>
> AND
> ___________________________________
> ALTER TABLE ONLY employee_role
> ADD CONSTRAINT fk_survey_id FOREIGN KEY (survey_id) REFERENCES
> employee_survey(survey_id) MATCH FULL ON UPDATE C
> ASCADE ON DELETE CASCADE;
>
> ALTER TABLE ONLY employee_role
> ADD CONSTRAINT fk_employee_id FOREIGN KEY (employee_id) REFERENCES
> employee_survey(employee_id) MATCH FULL ON UPDATE C
> ASCADE ON DELETE CASCADE;
> _____________________________________
>
>
> Thank you,
>
>
> Igor
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

  • FK question at 2004-08-26 06:48:12 from Igor Kryltsov

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2004-08-28 00:59:31 Re: job for sql, pl/pgsql,gawk,perl or ??
Previous Message Joshua D. Drake 2004-08-28 00:13:27 Re: PSql won't Let me Set Varchar Column to 'true'