I am trying to do a full text search in a postgres database using jOOQ. The following line works:
Result res = pgContext.select() .from(products.PRODUCTS) .where("to_tsvector(title || ' ' || description || ' ' || tags) @@ to_tsquery('" + query + "')") .fetch();
But when I add a variable binding to protect against SQL injection, I no longer get the results:
Result res = pgContext.select() .from(products.PRODUCTS) .where("to_tsvector(title || ' ' || description || ' ' || tags) @@ to_tsquery('?')", query) .fetch();
Any ideas?
Thanks and good afternoon
source share