title: How to check if a row exists in a PostgreSQL stored procedure?
body: <p>I writing a stored procedure in postgres where I need to check if a row exists then act accordingly. something along the line.</p>
  
  <pre><code>IF SELECT * FROM foo WHERE x = 'abc' AND y = 'xyz' THEN
    -- do something here
  ELSE 
    -- do something else
  END;
  </code></pre>
  
  <p>I have googled a bit but got no good hits.</p>