[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Uniqueness across multiple attributes



On 6/17/19 4:56 PM, Howard Chu wrote:
> Stefan Schmidt wrote:
>> thank you for your reply. The idea would have been to prevent
>> duplicates across mail and mailAlias from being created in the
>> first place, but you are right if OpenLDAP doesn't allow this then
>> using an external script to check if the mail addresses are unique
>> could be a workaround.>
> You could also try writing your schema such that mail and mailAlias
> are related through inheritance. E.g., make mailAlias a subtype of
> mail, or make them both inherit from a common supertype. Then set the
> uniqueness constraint on the supertype.

This does not work well if clients want to exactly search for a certain
mail value.

The better approach is to add all mail aliases to 'mailAlias' and add a
constraint which enforces 'mail' to be one of those values. Then simply
have a unique constraint on 'mailAlias'.
(You might have guessed: That's how mail alias are stored in Æ-DIR. ;-)

Ciao, Michael.