title: PostgreSQL stored procedure data parameter
body: <p>I have the following stored procedure, which returns 0 results but if the run the query by itself it result lot of results. What am i missing.</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION countStatistics(baselineDate Date) RETURNS int AS $$
  DECLARE
      qty int;
  BEGIN
      SELECT COUNT(*) INTO qty FROM statistics WHERE time_stamp = baselineDate;
      RETURN qty;
  END;
  $$ LANGUAGE plpgsql;
  
  --Execute the function
  SELECT countStatistics('2015-01-01 01:00:00') as qty;
  </code></pre>
  
  <p>return 0 results</p>
  
  <pre><code>SELECT COUNT(*) FROM statistics WHERE time_stamp = '2015-01-01 01:00:00';
  </code></pre>
  
  <p>return 100+ results</p>