title: Format specifier for integer variables in format() for EXECUTE?
body: <pre><code>CREATE OR REPLACE FUNCTION getParentLtree(parent_id bigint, tbl_name varchar) 
    RETURNS ltree AS
  $BODY$
  DECLARE
     parent_ltree ltree;
  BEGIN
  -- This works fine:
  -- select into parent_ltree l_tree from tbl1 where id = parent_id;
  
  EXECUTE format('select into parent_ltree l_tree from %I
                  where id = %I', tbl_name,parent_id);
  
  RETURN parent_ltree;
  END;
  $BODY$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>There are 2 issues in above function:</p>
  
  <ol>
  <li><code>parent_id</code> is <code>integer</code> but it is replaced with quotes? What is the correct format specifier for <code>int</code> variables?</li>
  <li><code>select into</code> does not work with <code>EXECUTE</code>? How can I make above commented query to use table name passed?</li>
  </ol>