On Tue, 29 Dec 2009, Tatsuo Ishii wrote:

parse
bind
describe
execute
<normaly done>
parse invalid SQL thus abort a transaction
bind (error)
describe (error)
execute (crush)

Please note that without pgpool backend does not crush. This is
because JDBC driver does not do execute() if prior parse, bind
etc. failed, I think.

The JDBC driver will fire away parse, bind, and execute all at once before a sync, to avoid network roundtrips, so your assumption of what's going on here without pgpool doesn't seem accurate. Attached is a test case that tries to duplicate what you've described and it errors out normally. Below is the JDBC driver's protocol level logging.

21:41:39.407 (1)  FE=> Parse(stmt=S_1,query="BEGIN",oids={})
21:41:39.407 (1)  FE=> Bind(stmt=S_1,portal=null)
21:41:39.407 (1)  FE=> Execute(portal=null,limit=0)
21:41:39.408 (1)  FE=> Parse(stmt=null,query="SELECT $1 ",oids={23})
21:41:39.408 (1)  FE=> Bind(stmt=null,portal=null,$1=<'1'>)
21:41:39.408 (1)  FE=> Describe(portal=null)
21:41:39.408 (1)  FE=> Execute(portal=null,limit=0)
21:41:39.408 (1) FE=> Parse(stmt=null,query=" SELECT SELECT $1 ",oids={23})
21:41:39.408 (1)  FE=> Bind(stmt=null,portal=null,$1=<'2'>)
21:41:39.409 (1)  FE=> Describe(portal=null)
21:41:39.409 (1)  FE=> Execute(portal=null,limit=0)
21:41:39.409 (1)  FE=> Sync
21:41:39.443 (1)  <=BE ParseComplete [S_1]
21:41:39.443 (1)  <=BE BindComplete [null]
21:41:39.443 (1)  <=BE CommandStatus(BEGIN)
21:41:39.443 (1)  <=BE ParseComplete [null]
21:41:39.443 (1)  <=BE BindComplete [null]
21:41:39.444 (1)  <=BE RowDescription(1)
21:41:39.444 (1)  <=BE DataRow
21:41:39.444 (1)  <=BE CommandStatus(SELECT)
21:41:39.454 (1) <=BE ErrorMessage(ERROR: syntax error at or near "SELECT"
  Position: 9)

So this shows everything working as expected. Perhaps enabling this logging on your JDBC client would show more clearly what it is trying to do.

Kris Jurka
import java.sql.*;

public class Crash {

        public static void main(String args[]) throws Exception {
                Class.forName("org.postgresql.Driver");
                Connection conn = 
DriverManager.getConnection("jdbc:postgresql://localhost:5844/jurka?loglevel=2","jurka","");
                conn.setAutoCommit(false);

                PreparedStatement pstmt = conn.prepareStatement("SELECT ? ; 
SELECT SELECT ? ");
                pstmt.setInt(1, 1);
                pstmt.setInt(2, 2);
                pstmt.execute();
        }
}

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to