title: If the parameter is null, select all records. Postgres
body: <p>I have a query, in which some parameters can sometimes arrive null, and when these arrive null, I want them to ignore those conditions.</p>
  
  <pre><code>SELECT DISTINCT on (i.empleado) i.id
  FROM rrhh.imputacion as i 
    INNER JOIN rrhh.empleado as e ON e.id = i.empleado 
    JOIN commons.persona AS pe ON e.persona_comun = pe.id 
    INNER JOIN rrhh.parte__imputaciones as pi ON pi.imputacion = i.id 
    INNER JOIN rrhh.parte as p ON pi.parte = p.id 
    WHERE i.dia &gt;= '2017-12-04' AND i.dia &lt;= '2017-12-11' and p.borrador = false  AND e.fecha_fin_contrato IS NULL AND e.security_domain_id = 2 
    and i.empleado = 126
  ORDER  BY i.empleado, i.dia DESC,i.id
  </code></pre>
  
  <p>I need if the value of my parameter:</p>
  
  <p>"and i.empleado = 126" &lt;- if the value is NULL, ignore this, and bring all the records, without filtering by i.empleado</p>
  
  <p>I do not see concrete examples for postgres.</p>
  
  <p>Thank you.</p>