Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ff239c3

Browse files
committed
Silence compilers about extractNotNullColumn()
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 14e87ff. Discussion: https://postgr.es/m/3649828.1731083171@sss.pgh.pa.us
1 parent 3f323eb commit ff239c3

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/backend/catalog/pg_constraint.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,6 @@ findDomainNotNullConstraint(Oid typid)
688688
AttrNumber
689689
extractNotNullColumn(HeapTuple constrTup)
690690
{
691-
AttrNumber colnum;
692691
Datum adatum;
693692
ArrayType *arr;
694693

@@ -704,13 +703,9 @@ extractNotNullColumn(HeapTuple constrTup)
704703
ARR_DIMS(arr)[0] != 1)
705704
elog(ERROR, "conkey is not a 1-D smallint array");
706705

707-
memcpy(&colnum, ARR_DATA_PTR(arr), sizeof(AttrNumber));
708-
Assert(colnum > 0 && colnum <= MaxAttrNumber);
706+
/* We leak the detoasted datum, but we don't care */
709707

710-
if ((Pointer) arr != DatumGetPointer(adatum))
711-
pfree(arr); /* free de-toasted copy, if any */
712-
713-
return colnum;
708+
return ((AttrNumber *) ARR_DATA_PTR(arr))[0];
714709
}
715710

716711
/*

0 commit comments

Comments
 (0)