doc icon indicating copy to clipboard operation
doc copied to clipboard

Full text query parse issue

Open jjxtra opened this issue 2 years ago • 1 comments

I am comparing behavior of the NpgsqlTypes.NpgsqlTsQuery.Parse(_query); vs just passing in my raw query string using EF.Functions.ToTsQuery(_query).

The short of the problem is that EF.Functions.ToTsQuery(_query) behaves as expected, while NpgsqlTypes.NpgsqlTsQuery.Parse(_query) seems to be stacking terms separated by | operators in a weird way and does not retrieve expected results on the server.

Is the syntax for NpgsqlTypes.NpgsqlTsQuery.Parse(_query) different from EF.Functions.ToTsQuery(_query)?

jjxtra avatar Jan 25 '23 23:01 jjxtra

@jjxtra NpgsqlTsQuery.Parse aims to be a compatible C# implementation of the PostgreSQL parsing logic. This is something that Npgsql used to do, which we generally no longer believe is a good idea: the database driver should not be replicating complex database textual representation parsing logic, and this kind of bug is a good example why.

We've generally been removing client-side parsing (e.g. see #4902), I believe we should remove this as well. In the meantime, I highly recommend avoiding NpgsqlTsQuery.Parse and only using ToTsQuery, which ensures that PostgreSQL is the one doing the parsing.

roji avatar Jan 26 '23 11:01 roji