title: PostgreSQL 9.3: IF NOT EXISTS
body: <p>I want to check whether the table exists or not in the database.</p>
  
  <pre><code>IF NOT EXISTS (SELECT * from INFORMATION_SCHEMA.Tables WHERE Table_name = 'test') THEN
  
      RAISE INFO 'Not exists';
  
  else
  
      RAISE INFO 'Exists';
  
  end if;
  </code></pre>
  
  <p>Getting an error:</p>
  
  <pre><code>ERROR:  syntax error at or near "IF"
  </code></pre>