Take the 2-minute tour ×

I have a situation and would appreciate some help.
I have two tables - Error and Warning:

Error   : Err_no, pattern(pk=Error_no)
Warning : War_no, pattern(pk=War_no)

Based on these tables I have to decide on the resolution and I have a separate table doing this:

Resolution : Code_no, resolution

I want to keep Code_no as foreign key to both Err_no(Error table) and War_no(Warning table). I am using Postgres and want to know if and how I can do that?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

You can redesign you tables,merge tables Error and Warning to one table:Message


using column type to distinguish error or warning.then you can keep Code_no as foreign key to Message(Msg_no).

share|improve this answer
yeah, I guess redesign would be a better option, thanks for pointing it out –  daydreamer Jul 30 '10 at 18:44

A foreign-key can reference one-and-only-one primary-key table - so you won't be able to have Code_no reference both tables.

share|improve this answer
I understand now. Thank you –  daydreamer Jul 30 '10 at 18:43

Your Answer


