Unique over 2 columns

ecxod's profile image ecxod posted 5 years ago in General Permalink

I am not sure but as far as I know a unique over 2 columns should accept a distinct entry only once in both columns.

Description

So basically in my example if I add a email in column eml, I should not be able to add the same email again in column emlreq.

If this is correct? If yes we have a bug.

ansgar's profile image ansgar posted 5 years ago Permalink

No, in a unique key, the combination of its values is unique over the whole table. So both columns can happily have the same values, as long as there is no other row containing the same combination:

eml emlreq
abc abc valid
def abc valid
def def valid
def def invalid duplicate to prior row!
justrusty's profile image justrusty posted 5 years ago Permalink

This isn't even a bug. It's just user error. I think this "birdshit" can be closed now. There are more important real bugs and feature requests.

ecxod's profile image ecxod posted 5 years ago Permalink

Ansgar, I hope I don't see this face in this forum anymore.

Please login to leave a reply, or register at first.