title: Handling typos with to_tsvector and to_tsquery in postgresql
body: <p>I have a simple table with these fields<a href="https://i.stack.imgur.com/aCdpZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aCdpZ.png" alt="enter image description here" /></a></p>
  <p>Last two fields are for indexing one with tsvector datatype and other with text datatype.</p>
  <p>I want to perform a query on name or id. I am doing this</p>
  <pre><code>SELECT * FROM foo WHERE foo.searchtext @@ to_tsquery('1234 &amp; abcd');  
  </code></pre>
  <p>It is working fine but now I want typos to be removed e.g if the name is abcd I type abbd then it should get all possible values.
  I have seen <code>pg_tgrm()</code> but It <a href="https://stackoverflow.com/a/15884833/7608629">does not</a> work with integers or tsvector</p>
  <p>There are other options I have tried to use <code>pg_tgrm()</code> with like I have stored my index in another field searchtextstring  with type text and query like</p>
  <pre><code>select *
        from foo
      where searchtextstring % '123' and searchtextstring % 'abbd';
  </code></pre>
  <p>but I don't think this is efficient and also this does not work for typos.</p>
  <p>How can I handle typos with to_tsquery?</p>