title: How to check, if a value is an integer with plpgsql?
body: <p>i am using this function in a trigger:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION xx() RETURNS trigger AS $xx$
      BEGIN   
          INSERT INTO my_log (x, y, z) VALUES (NEW.x, NEW.y, current_setting('myvar.user'));
          RETURN NULL;
      END;
  $xx$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>now i would like to check, if 'myvar.user' is a valid integer, and if not, do another INSERT statement.</p>
  
  <p>how would i do this?</p>