title: How to remove conditions from WHERE clause if parameters are NULL
body: <p>I'm passing 2 parameters to a PL/pgSQL function. Here's the query:</p>
  
  <pre><code>SELECT * 
  FROM table 
  WHERE col1 = param1 
    AND col2 = param2
  </code></pre>
  
  <p>Both parameters can be NULL, in which case the respective expression should be removed from the <code>WHERE</code> clause.</p>
  
  <p>How can I do that? With <code>IF</code> conditions?</p>