Multiple buildfarm animals warn that a newly added Assert() is
impossible to fail; remove it to avoid the noise. While at it, use
direct assignment to obtain the value we need, avoiding an unnecessary
memcpy().
(I decided to remove the "pfree" call for the detoasted short-datum;
because this is only used for DDL, it's not problematic to leak such a
small allocation.)
Noted by Tom Lane about
14e87ffa5c54.
Discussion: https://postgr.es/m/
3649828.
1731083171@sss.pgh.pa.us
AttrNumber
extractNotNullColumn(HeapTuple constrTup)
{
- AttrNumber colnum;
Datum adatum;
ArrayType *arr;
ARR_DIMS(arr)[0] != 1)
elog(ERROR, "conkey is not a 1-D smallint array");
- memcpy(&colnum, ARR_DATA_PTR(arr), sizeof(AttrNumber));
- Assert(colnum > 0 && colnum <= MaxAttrNumber);
+ /* We leak the detoasted datum, but we don't care */
- if ((Pointer) arr != DatumGetPointer(adatum))
- pfree(arr); /* free de-toasted copy, if any */
-
- return colnum;
+ return ((AttrNumber *) ARR_DATA_PTR(arr))[0];
}
/*