title: Postgres 9.6 : Function that returns array of strings
body: <p>I'm trying to create function that will return array of type text/varchar. Here is an example: </p>
  
  <pre><code>CREATE OR REPLACE FUNCTION schema.someFunction(text, text, text)
   RETURNS character varying[]
   LANGUAGE plpgsql
  AS $function$
  DECLARE
     i text;
     arr_len varchar[];
  BEGIN
  FOR i in (select string_to_array($1,','))
  LOOP
     arr_len := schema.someOtherFunctionThatReturnsText(i::text, $2, $3)::varchar;
  END LOOP;
  RETURN arr_len;
  END
  $function$
  ;
  </code></pre>
  
  <p>This function returns NULL rows all the time. I don't get it why. Any suggestions?</p>
  
  <p>Just to mention that schema.someOtherFunctionThatReturnsText returns text and it works fine.</p>