I'm not sure what value a tsquery has if it's composed from stopwords
only, but it doesn't seem to be null or equal to itself.
That strikes me as ... unintuitive, although I'm happy to be re-educated
on this.
I think it's because CompareTSQ (tsquery_op.c, line 142) doesn't have a
case to handle query sizes of zero. That's what seems to be returned
from tsearch/to_tsany.c lines ~ 345-350.
SELECT qid,words,query, (query is null) AS isnull, (query = to_tsquery(words)) as issame
FROM util.queries
ORDER BY qid DESC LIMIT 5;
NOTICE: text-search query contains only stop words or doesn't contain
lexemes, ignored
NOTICE: text-search query contains only stop words or doesn't contain
lexemes, ignored qid | words | query | isnull | issame
------+----------+------------+--------+-------- 1000 | to | | f | f 999 | or |
|f | f 998 | requests | 'request' | f | t 997 | site | 'site' | f | t 996 | document |
'document'| f | t
(5 rows)
-- Richard Huxton Archonet Ltd