@@ -59,13 +59,14 @@ static int compare_lexeme_textfreq(const void *e1, const void *e2);
59
59
60
60
61
61
/*
62
- * tsmatchsel -- Selectivity of "@@"
62
+ * tsvector2_matchsel -- Selectivity of "@@"
63
63
*
64
- * restriction selectivity function for tsvector @@ tsquery and
65
- * tsquery @@ tsvector
64
+ * restriction selectivity function for tsvector2 @@ tsquery and
65
+ * tsquery @@ tsvector2
66
66
*/
67
+ PG_FUNCTION_INFO_V1 (tsvector2_matchsel );
67
68
Datum
68
- tsmatchsel (PG_FUNCTION_ARGS )
69
+ tsvector2_matchsel (PG_FUNCTION_ARGS )
69
70
{
70
71
PlannerInfo * root = (PlannerInfo * ) PG_GETARG_POINTER (0 );
71
72
@@ -111,17 +112,10 @@ tsmatchsel(PG_FUNCTION_ARGS)
111
112
* check this because the Var might be the TSQuery not the TSVector.
112
113
*/
113
114
if (((Const * ) other )-> consttype == TSQUERYOID )
114
- {
115
- /* tsvector @@ tsquery or the other way around */
116
- Assert (vardata .vartype == TSVECTOROID );
117
-
118
115
selec = tsquerysel (& vardata , ((Const * ) other )-> constvalue );
119
- }
120
116
else
121
- {
122
117
/* If we can't see the query structure, must punt */
123
118
selec = DEFAULT_TS_MATCH_SEL ;
124
- }
125
119
126
120
ReleaseVariableStats (vardata );
127
121
@@ -132,20 +126,21 @@ tsmatchsel(PG_FUNCTION_ARGS)
132
126
133
127
134
128
/*
135
- * tsmatchjoinsel -- join selectivity of "@@"
129
+ * tsvector2_matchjoinsel -- join selectivity of "@@"
136
130
*
137
- * join selectivity function for tsvector @@ tsquery and tsquery @@ tsvector
131
+ * join selectivity function for tsvector2 @@ tsquery and tsquery @@ tsvector2
138
132
*/
133
+ PG_FUNCTION_INFO_V1 (tsvector2_matchjoinsel );
139
134
Datum
140
- tsmatchjoinsel (PG_FUNCTION_ARGS )
135
+ tsvector2_matchjoinsel (PG_FUNCTION_ARGS )
141
136
{
142
137
/* for the moment we just punt */
143
138
PG_RETURN_FLOAT8 (DEFAULT_TS_MATCH_SEL );
144
139
}
145
140
146
141
147
142
/*
148
- * @@ selectivity for tsvector var vs tsquery constant
143
+ * @@ selectivity for tsvector2 var vs tsquery constant
149
144
*/
150
145
static Selectivity
151
146
tsquerysel (VariableStatData * vardata , Datum constval )
@@ -167,13 +162,13 @@ tsquerysel(VariableStatData *vardata, Datum constval)
167
162
168
163
stats = (Form_pg_statistic ) GETSTRUCT (vardata -> statsTuple );
169
164
170
- /* MCELEM will be an array of TEXT elements for a tsvector column */
165
+ /* MCELEM will be an array of TEXT elements for a tsvector2 column */
171
166
if (get_attstatsslot (& sslot , vardata -> statsTuple ,
172
167
STATISTIC_KIND_MCELEM , InvalidOid ,
173
168
ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS ))
174
169
{
175
170
/*
176
- * There is a most-common-elements slot for the tsvector Var, so
171
+ * There is a most-common-elements slot for the tsvector2 Var, so
177
172
* use that.
178
173
*/
179
174
selec = mcelem_tsquery_selec (query , sslot .values , sslot .nvalues ,
@@ -219,7 +214,7 @@ mcelem_tsquery_selec(TSQuery query, Datum *mcelem, int nmcelem,
219
214
*
220
215
* (Note: the MCELEM statistics slot definition allows for a third extra
221
216
* number containing the frequency of nulls, but we're not expecting that
222
- * to appear for a tsvector column.)
217
+ * to appear for a tsvector2 column.)
223
218
*/
224
219
if (nnumbers != nmcelem + 2 )
225
220
return tsquery_opr_selec_no_stats (query );
@@ -271,7 +266,7 @@ mcelem_tsquery_selec(TSQuery query, Datum *mcelem, int nmcelem,
271
266
* The MCELEM array is already sorted (see ts_typanalyze.c), so we can use
272
267
* binary search for determining freq[MCELEM].
273
268
*
274
- * If we don't have stats for the tsvector , we still use this logic,
269
+ * If we don't have stats for the tsvector2 , we still use this logic,
275
270
* except we use default estimates for VAL nodes. This case is signaled
276
271
* by lookup == NULL.
277
272
*/
0 commit comments