52
52
53
53
static Oid ValidateRestrictionEstimator (List * restrictionName );
54
54
static Oid ValidateJoinEstimator (List * joinName );
55
-
56
- /*
57
- * XXX Maybe not the right name, because "estimator" implies we're calculating
58
- * selectivity. But we're actually deriving statistics for an expression.
59
- */
60
- static Oid ValidateStatisticsEstimator (List * joinName );
55
+ static Oid ValidateStatisticsDerivator (List * joinName );
61
56
62
57
/*
63
58
* DefineOperator
@@ -139,8 +134,7 @@ DefineOperator(List *names, List *parameters)
139
134
restrictionName = defGetQualifiedName (defel );
140
135
else if (strcmp (defel -> defname , "join" ) == 0 )
141
136
joinName = defGetQualifiedName (defel );
142
- /* XXX perhaps full "statistics" wording would be better */
143
- else if (strcmp (defel -> defname , "stats" ) == 0 )
137
+ else if (strcmp (defel -> defname , "statistics" ) == 0 )
144
138
statisticsName = defGetQualifiedName (defel );
145
139
else if (strcmp (defel -> defname , "hashes" ) == 0 )
146
140
canHash = defGetBoolean (defel );
@@ -258,7 +252,7 @@ DefineOperator(List *names, List *parameters)
258
252
else
259
253
joinOid = InvalidOid ;
260
254
if (statisticsName )
261
- statisticsOid = ValidateStatisticsEstimator (statisticsName );
255
+ statisticsOid = ValidateStatisticsDerivator (statisticsName );
262
256
else
263
257
statisticsOid = InvalidOid ;
264
258
@@ -378,7 +372,7 @@ ValidateJoinEstimator(List *joinName)
378
372
* correct signature and we have the permissions to attach it to an operator.
379
373
*/
380
374
static Oid
381
- ValidateStatisticsEstimator (List * statName )
375
+ ValidateStatisticsDerivator (List * statName )
382
376
{
383
377
Oid typeId [4 ];
384
378
Oid statOid ;
@@ -392,11 +386,11 @@ ValidateStatisticsEstimator(List *statName)
392
386
statOid = LookupFuncName (statName , 4 , typeId , false);
393
387
394
388
/* statistics estimators must return void */
395
- if (get_func_rettype (statOid ) != BOOLOID )
389
+ if (get_func_rettype (statOid ) != VOIDOID )
396
390
ereport (ERROR ,
397
391
(errcode (ERRCODE_INVALID_OBJECT_DEFINITION ),
398
392
errmsg ("statistics estimator function %s must return type %s" ,
399
- NameListToString (statName ), "boolean " )));
393
+ NameListToString (statName ), "void " )));
400
394
401
395
/* Require EXECUTE rights for the estimator */
402
396
aclresult = pg_proc_aclcheck (statOid , GetUserId (), ACL_EXECUTE );
@@ -555,7 +549,7 @@ AlterOperator(AlterOperatorStmt *stmt)
555
549
else
556
550
joinOid = InvalidOid ;
557
551
if (statName )
558
- statOid = ValidateStatisticsEstimator (statName );
552
+ statOid = ValidateStatisticsDerivator (statName );
559
553
else
560
554
statOid = InvalidOid ;
561
555
0 commit comments