Comment 3 for bug 810903

Revision history for this message
David Owen (dsowen) wrote :

This is one of the constraints that isn't re-created in a development environment yet:

CREATE UNIQUE INDEX emailaddress__person__key ON emailaddress (person) WHERE ((status = 4) AND (person IS NOT NULL));

For the set of rows where status=4 (preferred address) and person is not null, person must be unique; in other words, each person has at most one preferred address.

So, there must be another row for that person that is set as the preferred. However, the link between person and account is kind of flimsy, so it might be worth checking how rows in the person table line up with the account.