diff options
Diffstat (limited to 'contrib/intarray/_int_gin.c')
-rw-r--r-- | contrib/intarray/_int_gin.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/contrib/intarray/_int_gin.c b/contrib/intarray/_int_gin.c index 7bb9599b335..22484287862 100644 --- a/contrib/intarray/_int_gin.c +++ b/contrib/intarray/_int_gin.c @@ -6,7 +6,7 @@ Datum ginint4_queryextract(PG_FUNCTION_ARGS); Datum ginint4_queryextract(PG_FUNCTION_ARGS) { - uint32 *nentries = (uint32 *) PG_GETARG_POINTER(1); + int32 *nentries = (int32 *) PG_GETARG_POINTER(1); StrategyNumber strategy = PG_GETARG_UINT16(2); Datum *res = NULL; @@ -57,6 +57,19 @@ ginint4_queryextract(PG_FUNCTION_ARGS) } } + if ( nentries == 0 ) + { + switch( strategy ) + { + case BooleanSearchStrategy: + case RTOverlapStrategyNumber: + *nentries = -1; /* nobody can be found */ + break; + default: /* require fullscan: GIN can't find void arrays */ + break; + } + } + PG_RETURN_POINTER(res); } |