title: Query with a dynamic custom field type field
body: <p>The custom field type parameter should be dynamic my code looks something like the following:</p>
  <pre class="lang-sql prettyprint-override"><code>create or replace function somefunc(ip_address varchar, ip_type varchar) 
  returns table(fielda varchar, 
      fieldb varchar,  
  language plpgsql  
  as $$   
  begin   
     return query   
      execute format('select fielda, 
      fieldb, 
     
      from
     ips   
      join
     names on id = other_id
      where    
   iprange &gt;&gt;= ip_address::%s', ip_type); 
  end;    
  $$ 
  </code></pre>
  <p>As you can see I've tried using format, but then it thinks ip_address is a column.</p>