title: How to escape underscores in while preparing tsquery for PostgreSQL full text search?
body: <p>I have below <a href="https://www.postgresql.org/docs/current/functions-textsearch.html" rel="nofollow noreferrer"><code>plainto_tsquery</code></a> query as part of <a href="https://www.postgresql.org/docs/current/functions-textsearch.html" rel="nofollow noreferrer">full text searching</a> on a PostgreSQL table.</p>
  
  <pre><code>SELECT plainto_tsquery('english', 'flat discount on flight_tickets');
  </code></pre>
  
  <p>This query will return <code>'flat' &amp; 'discount' &amp; 'flight' &amp; 'ticket'</code></p>
  
  <p>Is there any way to make it to return <code>'flat' &amp; 'discount' &amp; 'flight_ticket'</code></p>
  
  <p>Just to avoid closing ticket by marking as duplicate, I have checked below stackoverflow questions</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/14103880/escaping-special-characters-in-to-tsquery">Escaping special characters in to_tsquery</a></li>
  <li><a href="https://stackoverflow.com/questions/16020164/psqlexception-error-syntax-error-in-tsquery/16020565#16020565">PSQLException: ERROR: syntax error in tsquery</a></li>
  </ul>