Skip to content

Commit c545e95

Browse files
committed
Don't prematurely cram a value into a short int.
Since a4d75c8, some buildfarm members have been warning that Assert(attnum <= MaxAttrNumber); is useless if attnum is an AttrNumber. I'm not certain how plausible it is that the value coming out of the bitmap could actually exceed MaxAttrNumber, but we seem to have thought that that was possible back in 7300a69. Revert the intermediate variable to int so that we have the same overflow protection as before.
1 parent 3b0c647 commit c545e95

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/statistics/extended_stats.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ build_attnums_array(Bitmapset *attrs, int nexprs, int *numattrs)
978978
j = -1;
979979
while ((j = bms_next_member(attrs, j)) >= 0)
980980
{
981-
AttrNumber attnum = (j - nexprs);
981+
int attnum = (j - nexprs);
982982

983983
/*
984984
* Make sure the bitmap contains only user-defined attributes. As

0 commit comments

Comments
 (0)