title: CREATE VIEW specifies more column names than columns
body: <p>If I run the following statements in PostgreSQL 9.4.8, I get this error message: </p>
  
  <blockquote>
    <p>CREATE VIEW specifies more column names than columns.</p>
  </blockquote>
  
  <p>But why? Doesn't <code>f1</code> return a table with 5 columns and shouldn't <code>v1</code> have 5 columns as well? Also, If I remove the casts from the first <code>SELECT</code> statement, I get this error message:</p>
  
  <blockquote>
    <p>Final statement returns unknown instead of character varying at column 1.</p>
  </blockquote>
  
  <p>But why? The correct type <code>VARCHAR(20)</code> is known from <code>RETURNS</code>, so why is there no implicit cast of strings such as <code>'a'</code>?</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION f1 (a1 INTEGER, a2 INTEGER)
  RETURNS TABLE (c1 VARCHAR(20), c2 VARCHAR(20), c3 INTEGER, c4 VARCHAR(20), c5 VARCHAR(128))
  AS $$
  SELECT 'a'::VARCHAR(20), 'b'::VARCHAR(20), 1::INTEGER, 'c'::VARCHAR(20), 'd'::VARCHAR(128);
  $$ LANGUAGE SQL;
  
  CREATE VIEW v1 (c1, c2, c3, c4, c5)
  AS SELECT f1 (1, 2);
  </code></pre>