title: How to use EXECUTE FORMAT ... USING in postgres function
body: <pre><code>CREATE OR REPLACE FUNCTION dummytest_insert_trigger()
    RETURNS trigger AS
  $BODY$
  DECLARE
  v_partition_name    VARCHAR(32);
          BEGIN
          IF NEW.datetime IS NOT NULL THEN
                  v_partition_name := 'dummyTest';            
                  EXECUTE format('INSERT INTO %I VALUES ($1,$2)',v_partition_name)using NEW.id,NEW.datetime;              
                  END IF;                    
             RETURN NULL;
          END;
          $BODY$
    LANGUAGE plpgsql VOLATILE
    COST 100;
  ALTER FUNCTION dummytest_insert_trigger()
    OWNER TO postgres;
  </code></pre>
  
  <p>I'm trying to insert using
  insert into dummyTest values(1,'2013-01-01 00:00:00+05:30');</p>
  
  <p>But it's showing error as </p>
  
  <pre><code>ERROR: function format(unknown) does not exist
  SQL state: 42883
  Hint: No function matches the given name and argument types. You might need to add explicit type casts.
  Context: PL/pgSQL function "dummytest_insert_trigger" line 8 at EXECUTE statement
  </code></pre>
  
  <p>I'm unable get the error.</p>