Обсуждение: BUG #17562: Strange behavior of to_tsquery() with a - character

Поиск
Список
Период
Сортировка

BUG #17562: Strange behavior of to_tsquery() with a - character

От
PG Bug reporting form
Дата:
The following bug has been logged on the website:

Bug reference:      17562
Logged by:          Jordan Lewis
Email address:      jordanthelewis@gmail.com
PostgreSQL version: 14.3
Operating system:   Linux
Description:

When using the to_tsquery function, including a - character in the input
produces a strange behavior: it returns a query that expects the entire
input next to the string to the left of the - character next to the string
to the right of the dash character.

Observe the following example:

jordan=> select to_tsquery('foo-bar');
          to_tsquery
-------------------------------
 'foo-bar' <-> 'foo' <-> 'bar'
(1 row)

I would expect that the correct behavior would be to either treat foo-bar as
a single search term, or to treat foo and bar as separate search terms
(which would cause this to fail because of the lack of operator separating
the terms).

In Postgres 13, the result is to separate the 3 terms by & instead of <->,
which still doesn't seem right to me.

Thoughts?

Thank you,
Jordan Lewis