BUG #17562: Strange behavior of to_tsquery() with a - character - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17562: Strange behavior of to_tsquery() with a - character
Date
Msg-id 17562-7c786bed7effbace@postgresql.org
Whole thread Raw
List pgsql-bugs
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


pgsql-bugs by date:

Previous
From: Jacob Champion
Date:
Subject: Re: RFC 9266: Channel Bindings for TLS 1.3 support
Next
From: Michael Paquier
Date:
Subject: Re: RFC 9266: Channel Bindings for TLS 1.3 support