title: Postgres error in creating a function
body: <p>I am trying to create a function in Postgres as follows:</p>
  
  <pre><code>Create function Samplefunc() 
  returns resultdata( Tested int, Score int,
         Growth int) as
  $BODY$
  Select 
         Count(distinct student_id) Tested, 
         Cast(Avg(R.raw_score) as Int)  Score,
         Avg(R.growth) as Growth
  from results R
  where R.id=1 and test_id='ME04';
  $BODY$
  LANGUAGE sql;
  </code></pre>
  
  <p>But I am getting the following error:</p>
  
  <pre><code>ERROR:  syntax error at or near "int"
  LINE 2: returns resultdata( NTested int, RawScore int,
                                      ^
  
  ********** Error **********
  
  ERROR: syntax error at or near "int"
  SQL state: 42601
  Character: 59
  </code></pre>
  
  <p>Where am I going wrong?</p>