On 07.02.24 04:06, jian he wrote:
/*
  * hashRowType
  *
  * If two tuple descriptors would be considered equal by equalRowTypes()
  * then their hash value will be equal according to this function.
  */
uint32
hashRowType(TupleDesc desc)
{
uint32 s;
int i;

s = hash_combine(0, hash_uint32(desc->natts));
s = hash_combine(s, hash_uint32(desc->tdtypeid));
for (i = 0; i < desc->natts; ++i)
s = hash_combine(s, hash_uint32(TupleDescAttr(desc, i)->atttypid));

return s;
}

from the hashRowType comment, should we also hash attname and atttypmod?

In principle, hashRowType() could process all the fields that equalRowTypes() does. But since it's only a hash function, it doesn't have to be perfect. (This is also the case for the current hashTupleDesc().) I'm not sure where the best tradeoff is.


Reply via email to