Hi Alexander, On Sun, Dec 20, 2020 at 04:21:16AM +0000, Alexander Korotkov wrote: > Multirange datatypes > > Multiranges are basically sorted arrays of non-overlapping ranges with > set-theoretic operations defined over them.
This commit is creating a compilation warning on Windows: multirangetypes.c(1033): warning C4715: 'multirange_constructor0' : not all control paths return a value See for example woodlouse: https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=woodlouse&dt=2020-12-21%2001%3A42%3A28&stg=make Looking at the code, it is obvious that the compiler cannot understand that this should always return. Please find attached a suggestion of patch. Thanks, -- Michael
diff --git a/src/backend/utils/adt/multirangetypes.c b/src/backend/utils/adt/multirangetypes.c
index a4dc439a21..06316ba6b6 100644
--- a/src/backend/utils/adt/multirangetypes.c
+++ b/src/backend/utils/adt/multirangetypes.c
@@ -1016,20 +1016,20 @@ multirange_constructor1(PG_FUNCTION_ARGS)
Datum
multirange_constructor0(PG_FUNCTION_ARGS)
{
- Oid mltrngtypid = get_fn_expr_rettype(fcinfo->flinfo);
+ Oid mltrngtypid;
TypeCacheEntry *typcache;
TypeCacheEntry *rangetyp;
+ /* This should always be called without arguments */
+ if (PG_NARGS() != 0)
+ elog(ERROR,
+ "niladic multirange constructor must not receive arguments");
+
+ mltrngtypid = get_fn_expr_rettype(fcinfo->flinfo);
typcache = multirange_get_typcache(fcinfo, mltrngtypid);
rangetyp = typcache->rngtype;
- /* We should always be called with no arguments */
-
- if (PG_NARGS() == 0)
- PG_RETURN_MULTIRANGE_P(make_multirange(mltrngtypid, rangetyp, 0, NULL));
- else
- elog(ERROR, /* can't happen */
- "niladic multirange constructor must not receive arguments");
+ PG_RETURN_MULTIRANGE_P(make_multirange(mltrngtypid, rangetyp, 0, NULL));
}
signature.asc
Description: PGP signature
