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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy