0

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?

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Message:(Msg_no,parrern,type(pk=Msg_no))

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

1 Comment

yeah, I guess redesign would be a better option, thanks for pointing it out

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.