title: PSQLException: current transaction is aborted, commands ignored until end of transaction block
body: <p>I am seeing the following (truncated) stacktrace in the server.log file of JBoss 7.1.1 Final:</p>
  
  <pre><code>Caused by: org.postgresql.util.PSQLException: 
  ERROR: current transaction is aborted, commands ignored until end of 
  transaction block
  
  at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
  at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
  at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
  at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
  at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
  at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:302)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_23]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_23]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_23]
  at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_23]
  at org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnection$StatementHandler.invoke(AbstractJdbc23PooledConnection.java:455)
  at $Proxy49.executeUpdate(Unknown Source)   at org.jboss.jca.adapters.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:371)
  at org.infinispan.loaders.jdbc.TableManipulation.executeUpdateSql(TableManipulation.java:154) [infinispan-cachestore-jdbc-5.1.2.FINAL.jar:5.1.2.FINAL]
  ... 154 more
  </code></pre>
  
  <p>Inspecting the Postgres log file reveals the following statements:</p>
  
  <pre><code>STATEMENT:  SELECT count(*) FROM ISPN_MIXED_BINARY_TABLE_configCache
  ERROR:  current transaction is aborted, commands ignored until end of transaction block
  STATEMENT:  CREATE TABLE ISPN_MIXED_BINARY_TABLE_configCache(ID_COLUMN VARCHAR(255) NOT NULL, DATA_COLUMN BYTEA, TIMESTAMP_COLUMN BIGINT, PRIMARY KEY (ID_COLUMN))
  ERROR:  relation "ispn_mixed_binary_table_configcache" does not exist at character 22
  </code></pre>
  
  <p>I am using the Infinispan shipped with JBoss 7.1.1 Final, which is 5.1.2.Final.</p>
  
  <p>So this is what I think is happening:</p>
  
  <ul>
  <li>Infinispan attempts to run the <code>SELECT count(*)...</code> statement in order to see if there are any records in the <code>ISPN_MIXED_BINARY_TABLE_configCache</code>;</li>
  <li>Postgres, for some reason, does not like this statement.</li>
  <li>Infinispan ignores this and plows ahead with the <code>CREATE TABLE</code> statement.</li>
  <li>Postgres barfs because it still thinks it's the same transaction, which Infinispan has failed to roll back, and this transaction is shafted from the first <code>SELECT count(*)...</code> statement.</li>
  </ul>
  
  <p>What does this error mean and any idea how to work around it?</p>