title: How to handle cases where array is empty in postgresql?
body: <p>I have a function written in plpythonu.</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION temp(t_x integer[])
    RETURNS void AS
  $BODY$
  .
  .
  .
  x=plpy.execute("""select array_to_string(select id from A where id=any(array%s) ), ',')"""%t_x)
  </code></pre>
  
  <p>On some cases when t_x is empty i get an error:</p>
  
  <blockquote>
    <p>ERROR:  cannot determine type of empty array</p>
  </blockquote>
  
  <p>How do I fix it?</p>