title: PostgreSQL 9.3: Check only time from timestamp
body: <p>I have the following table with one field of type <code>timestamp</code>.</p>
  
  <pre><code>Create table Test_Timestamp
  (
      ColumnA timestamp
  );
  </code></pre>
  
  <p>Now inserting some records for demonstration:</p>
  
  <pre><code>INSERT INTO Test_Timestamp VALUES('1900-01-01 01:21:15'),
                   ('1900-01-01 02:11:25'),
                   ('1900-01-01 12:52:10'),
                   ('1900-01-01 03:20:05');
  </code></pre>
  
  <p>Now I have created function <code>Function_Test</code> with two parameters namely <code>St_time</code> and <code>En_Time</code> which 
  are of type varchar, In which I only pass the <code>time</code> like <code>00:00:01</code>. And after that Function has 
  to return the table with that condition of two time's parameters.</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION Function_Test
  (
      St_Time varchar,
      En_Time varchar
  )
  
  RETURNS TABLE
  (
      columX timestamp
  )
  AS
  
  $BODY$
  
  Declare
      sql varchar;
      wher varchar;
  
  BEGIN
  
      wher := 'Where columna BETWEEN '|| to_char(cast(St_Time as time),'''HH24:MI:SS''') ||' AND  '|| to_char(cast(En_Time as time),'''HH24:MI:SS''') ||'';
  
      RAISE INFO '%',wher;
  
      sql := 'SELECT * FROM Test_Timestamp ' || wher ;
  
      RAISE INFO '%',sql;
  
      RETURN QUERY EXECUTE sql;
  
  END;
  
  $BODY$
  
  LANGUAGE PLPGSQL;
  </code></pre>
  
  <p>---Calling function</p>
  
  <pre><code>SELECT * FROM Function_Test('00:00:00','23:59:59');
  </code></pre>
  
  <p>But getting an error:</p>
  
  <pre><code>ERROR:  invalid input syntax for type timestamp: "00:00:01"
  LINE 1: ...ELECT * FROM Test_Timestamp where ColumnA BETWEEN '00:00:01'...  
  </code></pre>