@@ -145,7 +145,7 @@ static double eqjoinsel_inner(Oid operator,
145
145
static double eqjoinsel_semi (Oid operator ,
146
146
VariableStatData * vardata1 , VariableStatData * vardata2 );
147
147
static bool convert_to_scalar (Datum value , Oid valuetypid , double * scaledvalue ,
148
- Datum lobound , Datum hibound , Oid boundstypid , Oid boundscollid ,
148
+ Datum lobound , Datum hibound , Oid boundstypid ,
149
149
double * scaledlobound , double * scaledhibound );
150
150
static double convert_numeric_to_scalar (Datum value , Oid typid );
151
151
static void convert_string_to_scalar (char * value ,
@@ -164,10 +164,10 @@ static double convert_one_string_to_scalar(char *value,
164
164
int rangelo , int rangehi );
165
165
static double convert_one_bytea_to_scalar (unsigned char * value , int valuelen ,
166
166
int rangelo , int rangehi );
167
- static char * convert_string_datum (Datum value , Oid typid , Oid collid );
167
+ static char * convert_string_datum (Datum value , Oid typid );
168
168
static double convert_timevalue_to_scalar (Datum value , Oid typid );
169
169
static bool get_variable_range (PlannerInfo * root , VariableStatData * vardata ,
170
- Oid sortop , Oid collation , Datum * min , Datum * max );
170
+ Oid sortop , Datum * min , Datum * max );
171
171
static bool get_actual_variable_range (PlannerInfo * root ,
172
172
VariableStatData * vardata ,
173
173
Oid sortop ,
@@ -285,6 +285,7 @@ var_eq_const(VariableStatData *vardata, Oid operator,
285
285
FmgrInfo eqproc ;
286
286
287
287
fmgr_info (get_opcode (operator ), & eqproc );
288
+ fmgr_info_collation (DEFAULT_COLLATION_OID , & eqproc );
288
289
289
290
for (i = 0 ; i < nvalues ; i ++ )
290
291
{
@@ -514,7 +515,7 @@ scalarineqsel(PlannerInfo *root, Oid operator, bool isgt,
514
515
stats = (Form_pg_statistic ) GETSTRUCT (vardata -> statsTuple );
515
516
516
517
fmgr_info (get_opcode (operator ), & opproc );
517
- fmgr_info_collation (vardata -> attcollation , & opproc );
518
+ fmgr_info_collation (DEFAULT_COLLATION_OID , & opproc );
518
519
519
520
/*
520
521
* If we have most-common-values info, add up the fractions of the MCV
@@ -839,7 +840,7 @@ ineq_histogram_selectivity(PlannerInfo *root,
839
840
*/
840
841
if (convert_to_scalar (constval , consttype , & val ,
841
842
values [i - 1 ], values [i ],
842
- vardata -> vartype , vardata -> attcollation ,
843
+ vardata -> vartype ,
843
844
& low , & high ))
844
845
{
845
846
if (high <= low )
@@ -1700,6 +1701,7 @@ scalararraysel(PlannerInfo *root,
1700
1701
if (!oprsel )
1701
1702
return (Selectivity ) 0.5 ;
1702
1703
fmgr_info (oprsel , & oprselproc );
1704
+ fmgr_info_collation (DEFAULT_COLLATION_OID , & oprselproc );
1703
1705
1704
1706
/* deconstruct the expression */
1705
1707
Assert (list_length (clause -> args ) == 2 );
@@ -2116,6 +2118,7 @@ eqjoinsel_inner(Oid operator,
2116
2118
nmatches ;
2117
2119
2118
2120
fmgr_info (get_opcode (operator ), & eqproc );
2121
+ fmgr_info_collation (DEFAULT_COLLATION_OID , & eqproc );
2119
2122
hasmatch1 = (bool * ) palloc0 (nvalues1 * sizeof (bool ));
2120
2123
hasmatch2 = (bool * ) palloc0 (nvalues2 * sizeof (bool ));
2121
2124
@@ -2338,6 +2341,7 @@ eqjoinsel_semi(Oid operator,
2338
2341
nmatches ;
2339
2342
2340
2343
fmgr_info (get_opcode (operator ), & eqproc );
2344
+ fmgr_info_collation (DEFAULT_COLLATION_OID , & eqproc );
2341
2345
hasmatch1 = (bool * ) palloc0 (nvalues1 * sizeof (bool ));
2342
2346
hasmatch2 = (bool * ) palloc0 (nvalues2 * sizeof (bool ));
2343
2347
@@ -2588,7 +2592,7 @@ icnlikejoinsel(PG_FUNCTION_ARGS)
2588
2592
*/
2589
2593
void
2590
2594
mergejoinscansel (PlannerInfo * root , Node * clause ,
2591
- Oid opfamily , Oid collation , int strategy , bool nulls_first ,
2595
+ Oid opfamily , int strategy , bool nulls_first ,
2592
2596
Selectivity * leftstart , Selectivity * leftend ,
2593
2597
Selectivity * rightstart , Selectivity * rightend )
2594
2598
{
@@ -2757,20 +2761,20 @@ mergejoinscansel(PlannerInfo *root, Node *clause,
2757
2761
/* Try to get ranges of both inputs */
2758
2762
if (!isgt )
2759
2763
{
2760
- if (!get_variable_range (root , & leftvar , lstatop , collation ,
2764
+ if (!get_variable_range (root , & leftvar , lstatop ,
2761
2765
& leftmin , & leftmax ))
2762
2766
goto fail ; /* no range available from stats */
2763
- if (!get_variable_range (root , & rightvar , rstatop , collation ,
2767
+ if (!get_variable_range (root , & rightvar , rstatop ,
2764
2768
& rightmin , & rightmax ))
2765
2769
goto fail ; /* no range available from stats */
2766
2770
}
2767
2771
else
2768
2772
{
2769
2773
/* need to swap the max and min */
2770
- if (!get_variable_range (root , & leftvar , lstatop , collation ,
2774
+ if (!get_variable_range (root , & leftvar , lstatop ,
2771
2775
& leftmax , & leftmin ))
2772
2776
goto fail ; /* no range available from stats */
2773
- if (!get_variable_range (root , & rightvar , rstatop , collation ,
2777
+ if (!get_variable_range (root , & rightvar , rstatop ,
2774
2778
& rightmax , & rightmin ))
2775
2779
goto fail ; /* no range available from stats */
2776
2780
}
@@ -3371,7 +3375,7 @@ estimate_hash_bucketsize(PlannerInfo *root, Node *hashkey, double nbuckets)
3371
3375
*/
3372
3376
static bool
3373
3377
convert_to_scalar (Datum value , Oid valuetypid , double * scaledvalue ,
3374
- Datum lobound , Datum hibound , Oid boundstypid , Oid boundscollid ,
3378
+ Datum lobound , Datum hibound , Oid boundstypid ,
3375
3379
double * scaledlobound , double * scaledhibound )
3376
3380
{
3377
3381
/*
@@ -3424,9 +3428,9 @@ convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue,
3424
3428
case TEXTOID :
3425
3429
case NAMEOID :
3426
3430
{
3427
- char * valstr = convert_string_datum (value , valuetypid , boundscollid );
3428
- char * lostr = convert_string_datum (lobound , boundstypid , boundscollid );
3429
- char * histr = convert_string_datum (hibound , boundstypid , boundscollid );
3431
+ char * valstr = convert_string_datum (value , valuetypid );
3432
+ char * lostr = convert_string_datum (lobound , boundstypid );
3433
+ char * histr = convert_string_datum (hibound , boundstypid );
3430
3434
3431
3435
convert_string_to_scalar (valstr , scaledvalue ,
3432
3436
lostr , scaledlobound ,
@@ -3670,7 +3674,7 @@ convert_one_string_to_scalar(char *value, int rangelo, int rangehi)
3670
3674
* before continuing, so as to generate correct locale-specific results.
3671
3675
*/
3672
3676
static char *
3673
- convert_string_datum (Datum value , Oid typid , Oid collid )
3677
+ convert_string_datum (Datum value , Oid typid )
3674
3678
{
3675
3679
char * val ;
3676
3680
@@ -3703,7 +3707,7 @@ convert_string_datum(Datum value, Oid typid, Oid collid)
3703
3707
return NULL ;
3704
3708
}
3705
3709
3706
- if (!lc_collate_is_c (collid ))
3710
+ if (!lc_collate_is_c (DEFAULT_COLLATION_OID ))
3707
3711
{
3708
3712
char * xfrmstr ;
3709
3713
size_t xfrmlen ;
@@ -4102,7 +4106,6 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
4102
4106
vardata -> rel = find_base_rel (root , var -> varno );
4103
4107
vardata -> atttype = var -> vartype ;
4104
4108
vardata -> atttypmod = var -> vartypmod ;
4105
- vardata -> attcollation = var -> varcollid ;
4106
4109
vardata -> isunique = has_unique_index (vardata -> rel , var -> varattno );
4107
4110
4108
4111
rte = root -> simple_rte_array [var -> varno ];
@@ -4188,7 +4191,6 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
4188
4191
vardata -> var = node ;
4189
4192
vardata -> atttype = exprType (node );
4190
4193
vardata -> atttypmod = exprTypmod (node );
4191
- vardata -> attcollation = exprCollation (node );
4192
4194
4193
4195
if (onerel )
4194
4196
{
@@ -4397,7 +4399,7 @@ get_variable_numdistinct(VariableStatData *vardata)
4397
4399
* be "<" not ">", as only the former is likely to be found in pg_statistic.
4398
4400
*/
4399
4401
static bool
4400
- get_variable_range (PlannerInfo * root , VariableStatData * vardata , Oid sortop , Oid collation ,
4402
+ get_variable_range (PlannerInfo * root , VariableStatData * vardata , Oid sortop ,
4401
4403
Datum * min , Datum * max )
4402
4404
{
4403
4405
Datum tmin = 0 ;
@@ -4482,7 +4484,7 @@ get_variable_range(PlannerInfo *root, VariableStatData *vardata, Oid sortop, Oid
4482
4484
FmgrInfo opproc ;
4483
4485
4484
4486
fmgr_info (get_opcode (sortop ), & opproc );
4485
- fmgr_info_collation (collation , & opproc );
4487
+ fmgr_info_collation (DEFAULT_COLLATION_OID , & opproc );
4486
4488
4487
4489
for (i = 0 ; i < nvalues ; i ++ )
4488
4490
{
@@ -5109,6 +5111,7 @@ prefix_selectivity(PlannerInfo *root, VariableStatData *vardata,
5109
5111
if (cmpopr == InvalidOid )
5110
5112
elog (ERROR , "no >= operator for opfamily %u" , opfamily );
5111
5113
fmgr_info (get_opcode (cmpopr ), & opproc );
5114
+ fmgr_info_collation (DEFAULT_COLLATION_OID , & opproc );
5112
5115
5113
5116
prefixsel = ineq_histogram_selectivity (root , vardata , & opproc , true,
5114
5117
prefixcon -> constvalue ,
@@ -5130,6 +5133,7 @@ prefix_selectivity(PlannerInfo *root, VariableStatData *vardata,
5130
5133
if (cmpopr == InvalidOid )
5131
5134
elog (ERROR , "no < operator for opfamily %u" , opfamily );
5132
5135
fmgr_info (get_opcode (cmpopr ), & opproc );
5136
+ fmgr_info_collation (DEFAULT_COLLATION_OID , & opproc );
5133
5137
5134
5138
greaterstrcon = make_greater_string (prefixcon , & opproc );
5135
5139
if (greaterstrcon )
0 commit comments