<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello Tatsuo et al.,<br>
<br>
I have a small piece of code that behaves differently through
pgpool-II (currently development code) than through PostgreSQL 9.2:<br>
<br>
<pre><br>
package pg;<br>
import java.sql.Connection;<br>
import java.sql.DriverManager;<br>
import java.sql.Statement;<br>
<br>
public class RepeatedFailures {<br>
<br>
private static final String[] queries = {<br>
"create table x",<br>
"select splat from splatter",<br>
"create table x(i int)"<br>
};<br>
<br>
public static void main(String[] args) throws Exception {<br>
Class.forName("org.postgresql.Driver");<br>
<br>
Connection conn =
DriverManager.getConnection("jdbc:postgresql://{server}/seantest",
"seantest", "seantest");<br>
for (String query : queries) {<br>
Statement st = conn.createStatement();<br>
try {<br>
st.execute(query);<br>
System.out.println("Success: " + query);<br>
} catch (Exception e) {<br>
System.out.println("Ignoring: " + e);<br>
}<br>
}<br>
System.out.println("Completed");<br>
conn.close();<br>
}<br>
<br>
}<br>
</pre><br>
<br>
The first and second statements are meant to fail in different ways,
and the last to succeed.<br>
<br>
If {server} is a pgpool-II instance then the last query is rejected
with "current transaction is aborted, commands ignored until end of
transaction block". If it is a real PostgreSQL instance it succeeds
as one would expect. The pgpool-II server is set up in replication
mode as per
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="http://pgpool.projects.pgfoundry.org/pgpool-II/doc/pgpool-en.html">http://pgpool.projects.pgfoundry.org/pgpool-II/doc/pgpool-en.html</a>.<br>
<br>
Note that auto-commit is default (true).<br>
<br>
If I comment out the syntactically incorrect statement (the first
one), then the last query succeeds with both PostgreSQL and pgpool.<br>
<br>
Is this a bug, or expected behaviour?<br>
<br>
Thanks,<br>
Sean<br>
</body>
</html>