title: PostgreSQL timestamp/numeric precision ignored on function parameter?
body: <p>Given the following PostgreSQL functions:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION fn_dtm (
      dtm timestamptz(0))
  RETURNS void AS $$
  BEGIN
      RAISE NOTICE 'fn: %, %', dtm, dtm::timestamptz(0);
  END;
  $$ LANGUAGE plpgsql;
  
  CREATE OR REPLACE FUNCTION fn_num (
      num numeric(5, 2))
  RETURNS void AS $$
  BEGIN
      RAISE NOTICE 'num: %, %', num, num::numeric(5, 2);
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>Would you expect the output of these functions to show the result as per the type declared in the function parameter?</p>
  
  <p>I was very surprised to find that the precision was retained and shown in the "NOTICE" despite the parameter type limiting the precision.</p>
  
  <p>Is this a bug or am I just thinking about it the wrong way?</p>
  
  <pre><code>Here is the output:
  
  db=&gt; SELECT fn_dtm(now());
  NOTICE:  fn: 2015-02-05 10:25:44.184+00, 2015-02-05 10:25:44+00
  
  db=&gt; SELECT fn_num(1.23456789);
  NOTICE:  num: 1.23456789, 1.23
  </code></pre>
  
  <p>I am using PostgreSQL 9.3.</p>
  
  <p><strong>EDIT:</strong>
  If I do this I get what I expect:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION fn_dtm (
      dtm timestamptz(0))
  RETURNS void AS $$
  BEGIN
      dtm = dtm::timestamptz(0); ----- CHANGE PRECISION
      RAISE NOTICE 'fn: %', dtm;
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>Gives:</p>
  
  <pre><code>db=&gt; SELECT fn_dtm(now());
  NOTICE:  fn: 2015-02-05 10:38:38+00
  </code></pre>