Hi, I was looking at pcre.c for some inspiration and found something suspicious.

At the end of both pcre_likeselect() and re_likeselect():

if (bn && !msg) {
  BATsetcount(bn, BATcount(bn)); /* set some properties */
  bn->tsorted = true;
  bn->trevsorted = bn->batCount <= 1;
  bn->tkey = true;
  bn->tseqbase = bn->batCount == 0 ? 0 : bn->batCount == 1 ? * (oid *) Tloc(bn, 0) : oid_nil;
}


Which I read as: if everything went well, then the result is sorted and key. But I miss why it should be sorted and key.

Roberto