if (HeapTupleIsValid(tuple))
{
- Oid typid;
- int32 typmod;
float4 *numbers;
int nnumbers;
- /* XXX this code would break with different storage type */
- get_atttypetypmod(relid, colnum, &typid, &typmod);
-
- if (get_attstatsslot(tuple, typid, typmod,
+ if (get_attstatsslot(tuple, InvalidOid, 0,
STATISTIC_KIND_CORRELATION,
index->ordering[0],
NULL, NULL, &numbers, &nnumbers))
else
*indexCorrelation = varCorrelation;
- free_attstatsslot(typid, NULL, 0, numbers, nnumbers);
+ free_attstatsslot(InvalidOid, NULL, 0, numbers, nnumbers);
}
ReleaseSysCache(tuple);
}
* entry, and we don't want to repeat the cache lookup unnecessarily.
*
* statstuple: pg_statistics tuple to be examined.
- * atttype: type OID of attribute.
- * atttypmod: typmod of attribute.
+ * atttype: type OID of attribute (can be InvalidOid if values == NULL).
+ * atttypmod: typmod of attribute (can be 0 if values == NULL).
* reqkind: STAKIND code for desired statistics slot kind.
* reqop: STAOP value wanted, or InvalidOid if don't care.
* values, nvalues: if not NULL, the slot's stavalues are extracted.
return true;
}
+/*
+ * free_attstatsslot
+ * Free data allocated by get_attstatsslot
+ *
+ * atttype need be valid only if values != NULL.
+ */
void
free_attstatsslot(Oid atttype,
Datum *values, int nvalues,