Commit ad3107b9 authored by Tomas Vondra's avatar Tomas Vondra

Fix compiler warnings in multivariate MCV code

Compiler warnings were observed on gcc 3.4.6 (on gaur).

The assert is unnecessary, as the indexes are uint16 and so always >= 0.

Reported-by: Tom Lane
parent ea4e1c0e
...@@ -740,7 +740,6 @@ statext_mcv_serialize(MCVList * mcvlist, VacAttrStats **stats) ...@@ -740,7 +740,6 @@ statext_mcv_serialize(MCVList * mcvlist, VacAttrStats **stats)
ITEM_INDEXES(item)[dim] = (uint16) (value - values[dim]); ITEM_INDEXES(item)[dim] = (uint16) (value - values[dim]);
/* check the index is within expected bounds */ /* check the index is within expected bounds */
Assert(ITEM_INDEXES(item)[dim] >= 0);
Assert(ITEM_INDEXES(item)[dim] < info[dim].nvalues); Assert(ITEM_INDEXES(item)[dim] < info[dim].nvalues);
} }
...@@ -814,7 +813,7 @@ statext_mcv_deserialize(bytea *data) ...@@ -814,7 +813,7 @@ statext_mcv_deserialize(bytea *data)
* header. * header.
*/ */
if (VARSIZE_ANY_EXHDR(data) < offsetof(MCVList, items)) if (VARSIZE_ANY_EXHDR(data) < offsetof(MCVList, items))
elog(ERROR, "invalid MCV size %ld (expected at least %zu)", elog(ERROR, "invalid MCV size %zd (expected at least %zu)",
VARSIZE_ANY_EXHDR(data), offsetof(MCVList, items)); VARSIZE_ANY_EXHDR(data), offsetof(MCVList, items));
/* read the MCV list header */ /* read the MCV list header */
...@@ -870,7 +869,7 @@ statext_mcv_deserialize(bytea *data) ...@@ -870,7 +869,7 @@ statext_mcv_deserialize(bytea *data)
* to do this check first, before accessing the dimension info. * to do this check first, before accessing the dimension info.
*/ */
if (VARSIZE_ANY_EXHDR(data) < expected_size) if (VARSIZE_ANY_EXHDR(data) < expected_size)
elog(ERROR, "invalid MCV size %ld (expected %zu)", elog(ERROR, "invalid MCV size %zd (expected %zu)",
VARSIZE_ANY_EXHDR(data), expected_size); VARSIZE_ANY_EXHDR(data), expected_size);
/* Now it's safe to access the dimension info. */ /* Now it's safe to access the dimension info. */
...@@ -896,7 +895,7 @@ statext_mcv_deserialize(bytea *data) ...@@ -896,7 +895,7 @@ statext_mcv_deserialize(bytea *data)
* check on size. * check on size.
*/ */
if (VARSIZE_ANY_EXHDR(data) != expected_size) if (VARSIZE_ANY_EXHDR(data) != expected_size)
elog(ERROR, "invalid MCV size %ld (expected %zu)", elog(ERROR, "invalid MCV size %zd (expected %zu)",
VARSIZE_ANY_EXHDR(data), expected_size); VARSIZE_ANY_EXHDR(data), expected_size);
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment