title: Getting Error - No function matches the given name and argument types. in Postgres
body: <p>I create a function and inside the function, I used predefined function <code>array_to_string</code>. When I try to execute my function I am getting the following error.</p>
  
  <pre><code>ERROR:  function array_to_string(integer, unknown) does not exist
  LINE 1: SELECT array_to_string(id, ',') FROM ame.stops where custome...
                 ^
  HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
  QUERY:  SELECT array_to_string(id, ',') FROM ame.stops where customer_id=customer_id and driver_id=driver_id
  CONTEXT:  PL/pgSQL function ame.fn_get_stopids(integer,integer) line 4 at SQL statement
  SQL state: 42883
  </code></pre>
  
  <p>When I use <code>array_to_string</code> in <code>select</code> statement it's working fine.</p>
  
  <pre><code>select array_to_string(array(SELECT id FROM ame.stops where customer_id='31' and driver_id='770'), ', ')
  </code></pre>
  
  <p><strong>Function Code</strong></p>
  
  <pre><code>CREATE OR REPLACE FUNCTION ame.fn_Get_StopIds(customer_id integer, driver_id  integer) 
  RETURNS text AS $$
  DECLARE StopIds text;
  BEGIN
      SELECT array_to_string(id, ',') FROM ame.stops where customer_id=customer_id and driver_id=driver_id into StopIds;
      RETURN StopIds;
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>