title: ERROR Relation already exists in PostgreSQL when creating an index on a table
body: <p>I have an error when running the the queries below on PostgreSQL from a Java code</p>
  
  <pre><code> .....
   sql =  "CREATE TABLE IF NOT EXISTS table1 (s VARCHAR(100), p VARCHAR(100), o VARCHAR(100), PRIMARY KEY (s,p,o)) ; ";                   
   pgsql.runUpdateQuery(sql);         
  
   sql =  "CREATE INDEX indextable1 ON table1 (s,p,o);";  
   pgsql.runUpdateQuery(sql);         
   .....
  </code></pre>
  
  <p>But i got the following Error</p>
  
  <pre><code>org.postgresql.util.PSQLException: ERROR: relation "indextable1" already exists         
  </code></pre>
  
  <p>Can someone explain me what its happening? My understanding is that <code>PRIMARY KEY</code> is consider to be an <code>INDEX</code> and therefore the second query fail. Am I right ?</p>