postgres.git / summary / log / commit / refs
commit c545e9524dcfcfce25c370f584b31562e8d7a4b7
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Wed Mar 31 20:45:17 2021 +0000
First released in: 14.0
Don't prematurely cram a value into a short int.
Since a4d75c86b, 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 7300a6995. Revert the intermediate variable to int so that we have
the same overflow protection as before.
src/backend/statistics/extended_stats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 8c75690fce8..dd3c84a91c0 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -978,7 +978,7 @@ build_attnums_array(Bitmapset *attrs, int nexprs, int *numattrs)
j = -1;
while ((j = bms_next_member(attrs, j)) >= 0)
{
- AttrNumber attnum = (j - nexprs);
+ int attnum = (j - nexprs);
/*
* Make sure the bitmap contains only user-defined attributes. As
[parent: 3b0c647bbfc5]