index 27cb30f77b75b58c4310fa3c1e1fdc370c97e705..890019c05897c5c212b10bac0a76a71b0c396580 100644 (file)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tsearch/ts_selfuncs.c,v 1.2 2009年01月01日 17:23:48 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/tsearch/ts_selfuncs.c,v 1.3 2009年06月03日 18:42:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
tsquerysel(VariableStatData *vardata, Datum constval)
{
Selectivity selec;
+ TSQuery query;
+
+ /* The caller made sure the const is a TSQuery, so get it now */
+ query = DatumGetTSQuery(constval);
+
+ /* Empty query matches nothing */
+ if (query->size == 0)
+ return (Selectivity) 0.0;
if (HeapTupleIsValid(vardata->statsTuple))
{
- TSQuery query;
Form_pg_statistic stats;
Datum *values;
int nvalues;
float4 *numbers;
int nnumbers;
- /* The caller made sure the const is a TSQuery, so get it now */
- query = DatumGetTSQuery(constval);
-
stats = (Form_pg_statistic) GETSTRUCT(vardata->statsTuple);
/* MCELEM will be an array of TEXT elements for a tsvector column */