title: fetch all rows if where field is empty in postgres
body: <p>I am working with a sql query where I have fields set dynamically but few of the fields values can be null,In case its null I want to fetch all the records with that column data.</p>
  <p>like:</p>
  <pre><code>Select * from users where name=:name and class=:class;
  </code></pre>
  <p>Now suppose I have got value of only name variable and not the class,So now As class variable is not there It will give a error but I want to fetch users with all the classes in that case?</p>
  <p>I tried this but it doesnt work:</p>
  <pre><code>MapSqlParameterSource params = new MapSqlParameterSource();
  params.addValue(&quot;name&quot;, request.params.name);
  //run the query
  </code></pre>
  <p>How can I achieve this?</p>