Extended query protocol violation?

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Extended query protocol violation?
Date: 2015-08-30 23:02:33
Message-ID: 20150831.080233.1337812268065215575.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While playing with Java application using JDBC driver, I noticed
an interesting fact:

When autocommit is off, JDBC driver issues following messages:

20:10:54.731 (2) FE=> Parse(stmt=S_1,query="BEGIN",oids={})
20:10:54.731 (2) FE=> Bind(stmt=S_1,portal=null)
20:10:54.731 (2) FE=> Execute(portal=null,limit=0)
20:10:54.732 (2) FE=> Parse(stmt=null,query="SELECT ...
20:10:54.733 (2) FE=> Bind(stmt=null,portal=null)
20:10:54.733 (2) FE=> Describe(portal=null)
20:10:54.733 (2) FE=> Execute(portal=null,limit=0)
20:10:54.733 (2) FE=> Sync
20:10:54.734 (2) <=BE ParseComplete [S_1]
20:10:54.734 (2) <=BE BindComplete [null]
20:10:54.734 (2) <=BE CommandStatus(BEGIN)
20:10:54.735 (2) <=BE ParseComplete [null]
20:10:54.735 (2) <=BE BindComplete [null]
20:10:54.735 (2) <=BE RowDescription(15)

Notice that JDBC driver sends Parse, Bind and Execute without Sync
followed then immediately sends another Parse message. I wonder if
this violates our extended query protocol. From the manual:

"At completion of each series of extended-query messages, the frontend
should issue a Sync message."

"each series of extended-query messages" is a little vague here but it
seems it referes to a sequence of message starting with parse and
ending with execute message to me. If so, I think above example of
message sequence violates the protocol.

The application produces the packet sequence is essentially like this:

connection.setAutoCommit(false);
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);

Comments?
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2015-08-30 23:04:16 Re: Horizontal scalability/sharding
Previous Message Tom Lane 2015-08-30 22:57:08 Re: Potential GIN vacuum bug