[Sqlalchemy-tickets] Issue #3286: PostgreSQL fulltext search broken when query string is not in pro
Brought to you by:
zzzeek
|
From: Priit L. <iss...@bi...> - 2015-01-13 08:31:21
|
New issue 3286: PostgreSQL fulltext search broken when query string is not in proper tsquery format https://bitbucket.org/zzzeek/sqlalchemy/issue/3286/postgresql-fulltext-search-broken-when Priit Laes: Postgres full text search with query strings that are not in proper format fails. Example from documentation: Following SQLAlchemy code (taken from "Full Text Search" section under PostgreSQL dialect docs): ```select([sometable.c.text.match("search string")])``` should emit following SQL: ```SELECT text @@ to_tsquery('search string') FROM table``` But when executing that (using real column name and table name) ends up with: ```ERROR: syntax error in tsquery: "search string"``` There's ```plainto_tsquery``` function that should be used instead, when query string is not in proper format: ```SELECT text @@ plainto_tsquery('search string') FROM table``` My idea would be to use plainto_tsquery with column.match and introduce column.match_tsquery which ends up emitting to_tsquery SQL. |