Skip to content

Commit a3c1a11

Browse files
committed
If we're going to expose VariableStatData for contrib modules to use,
then we should export a reasonable set of the supporting routines too.
1 parent f1b3d5b commit a3c1a11

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/backend/utils/adt/selfuncs.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.201 2006/04/26 22:32:56 momjian Exp $
18+
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.202 2006/04/27 00:46:58 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -111,8 +111,6 @@
111111
#include "utils/syscache.h"
112112

113113

114-
static double mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc,
115-
Datum constval, double *sumcommonp);
116114
static double ineq_histogram_selectivity(VariableStatData *vardata,
117115
FmgrInfo *opproc, bool isgt,
118116
Datum constval, Oid consttype);
@@ -138,12 +136,6 @@ static double convert_one_bytea_to_scalar(unsigned char *value, int valuelen,
138136
int rangelo, int rangehi);
139137
static char *convert_string_datum(Datum value, Oid typid);
140138
static double convert_timevalue_to_scalar(Datum value, Oid typid);
141-
static void get_join_variables(PlannerInfo *root, List *args,
142-
VariableStatData *vardata1,
143-
VariableStatData *vardata2);
144-
static void examine_variable(PlannerInfo *root, Node *node, int varRelid,
145-
VariableStatData *vardata);
146-
static double get_variable_numdistinct(VariableStatData *vardata);
147139
static bool get_variable_maximum(PlannerInfo *root, VariableStatData *vardata,
148140
Oid sortop, Datum *max);
149141
static Selectivity prefix_selectivity(VariableStatData *vardata,
@@ -476,7 +468,7 @@ scalarineqsel(PlannerInfo *root, Oid operator, bool isgt,
476468
* total population is returned into *sumcommonp. Zeroes are returned
477469
* if there is no MCV list.
478470
*/
479-
static double
471+
double
480472
mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc, Datum constval,
481473
double *sumcommonp)
482474
{
@@ -3203,7 +3195,7 @@ get_restriction_variable(PlannerInfo *root, List *args, int varRelid,
32033195
* get_join_variables
32043196
* Apply examine_variable() to each side of a join clause.
32053197
*/
3206-
static void
3198+
void
32073199
get_join_variables(PlannerInfo *root, List *args,
32083200
VariableStatData *vardata1, VariableStatData *vardata2)
32093201
{
@@ -3246,7 +3238,7 @@ get_join_variables(PlannerInfo *root, List *args,
32463238
*
32473239
* Caller is responsible for doing ReleaseVariableStats() before exiting.
32483240
*/
3249-
static void
3241+
void
32503242
examine_variable(PlannerInfo *root, Node *node, int varRelid,
32513243
VariableStatData *vardata)
32523244
{
@@ -3429,7 +3421,7 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
34293421
* NB: be careful to produce an integral result, since callers may compare
34303422
* the result to exact integer counts.
34313423
*/
3432-
static double
3424+
double
34333425
get_variable_numdistinct(VariableStatData *vardata)
34343426
{
34353427
double stadistinct;

src/include/utils/selfuncs.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $PostgreSQL: pgsql/src/include/utils/selfuncs.h,v 1.30 2006/04/26 22:33:36 momjian Exp $
11+
* $PostgreSQL: pgsql/src/include/utils/selfuncs.h,v 1.31 2006/04/27 00:46:59 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -97,6 +97,19 @@ typedef enum
9797

9898
/* selfuncs.c */
9999

100+
extern void examine_variable(PlannerInfo *root, Node *node, int varRelid,
101+
VariableStatData *vardata);
102+
extern bool get_restriction_variable(PlannerInfo *root, List *args,
103+
int varRelid,
104+
VariableStatData *vardata, Node **other,
105+
bool *varonleft);
106+
extern void get_join_variables(PlannerInfo *root, List *args,
107+
VariableStatData *vardata1,
108+
VariableStatData *vardata2);
109+
extern double get_variable_numdistinct(VariableStatData *vardata);
110+
extern double mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc,
111+
Datum constval, double *sumcommonp);
112+
100113
extern Pattern_Prefix_Status pattern_fixed_prefix(Const *patt,
101114
Pattern_Type ptype,
102115
Const **prefix,
@@ -154,8 +167,5 @@ extern Selectivity estimate_hash_bucketsize(PlannerInfo *root, Node *hashkey,
154167
extern Datum btcostestimate(PG_FUNCTION_ARGS);
155168
extern Datum hashcostestimate(PG_FUNCTION_ARGS);
156169
extern Datum gistcostestimate(PG_FUNCTION_ARGS);
157-
extern bool get_restriction_variable(PlannerInfo *root, List *args, int varRelid,
158-
VariableStatData *vardata, Node **other,
159-
bool *varonleft);
160170

161171
#endif /* SELFUNCS_H */

0 commit comments

Comments
 (0)