[ldb] Unique indexes in ldb?

simo idra at samba.org
Tue Mar 25 03:17:26 GMT 2008

On Tue, 2008-03-25 at 12:22 +1100, Andrew Bartlett wrote:
> How hard would it be to add unique indexes to ldb?
> In the AD schema, a number of items are marked as being unique, and I
> presume this maps down to a unique index in their JET database. 
> I'm wondering, how hard would it be to add such an index to ldb?  This
> would remove a lot of the complexity from modules such as samldb (which
> tries to prevent duplicate SIDs). 
> Thoughts?

Does not sound too hard to do, all we need to do is to mark an attribute
as unique and check the index value is the only one present or return an
The check should be done in one of the calls made by
ltdb_store()->ltdb_index_add(), probably the most appropriate is
ltdb_index_add1() but we need to pass down the information about the
attribute being marked as unique.

I guess the biggest problem is what to do if we change an attribute to
be unique when the database is already populated and we actually have
duplicate values.


Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Senior Software Engineer at Red Hat Inc. <ssorce at redhat.com>

More information about the samba-technical mailing list