[Date Prev][Date Next]
Re: createtimestamp sorting
> I'm using OpenLDAP 2.1.12.
> The attribute createtimestamp is visible and accurate. When I sort
> entries by it, however, the results are unpredictable. The attribute is
> not in any schema, so I'm assuming it's internally managed. There isn't
It is an operational attribute; it is standard track, however.
> anything in the list archives even mentioning it for the past few years,
> so I have to ask...
> Why can't openldap sort on createtimestamp? There's no "standard schema"
> excuse this time. The value would be immense, to say the least.
We can, of course. I assume you're talking about client side sorting.
If you use '-S createTimeStamp' with ldapsearch, it does a strcasecmp()
sort of the value, which is not totally correct if you used etherogeneous
forms of generalizedTime (e.g. YYYYMMDDhhmmssZ mixed with
YYMMDDhhmmss+hhmm) you won't get the appropriate match.
Fortunately, slapd only uses the zulu form (with trailing 'Z'), so
the match will be correct. Of course, for ldapsearch to be able to
sort entries, you need to request createTimeStamp explicitly, since
it is not returned by default (as usually happens to operational
If I do
ldapsearch <standard options> -S modifyTimeStamp <filter> modifyTimeStamp
I get the correct result; If I do
ldapsearch <standard options> -S modifyTimeStamp <filter> <attrs; no
I get the entries in the order they were modified (note: I made the
test with modifyTimeStamp, since they are always returned in the order
they were created; your sort is meaningless, but this is implementation
dependent and you should not rely on it).