Search code examples
postgresqlfull-text-search

PostgreSQL Full Text search with Datetime string


I need some help understanding why PG returns false for this search query:

select to_tsvector('2021-07-01T00:57:43Z') @@ to_tsquery('2021-07-01T00<->57<->43Z');

Separately:

select to_tsvector('2021-07-01T00:57:43Z');
-------------------------------------------------
 '-01':3 '-07':2 '2021':1 '43z':6 '57':5 't00':4

select to_tsquery('2021-07-01T00<->57<->43Z');
                      to_tsquery                       
-------------------------------------------------------
 ( '2021' & '-07' & '-01' & 't00' ) <-> '57' <-> '43z'

What is the significance of the parenthesis here? All the lexemes inside the parenthesis are present in the tsvector, and positionally the <-> operators are also satisfied. So why isn't this a match?


Solution

  • This is a bug that will be fixed in v14. But it looks like the fix was considered too invasive to back-patch, so it will not be fixed in the point releases for the older versions.