Re: Extended query protocol violation?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Extended query protocol violation?
Date: 2015-08-30 23:23:19
Message-ID: 13855.1440976999@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tatsuo Ishii <ishii(at)postgresql(dot)org> writes:
> 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.

It does not.

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

That's a "should", not a "must". The important point here is that if the
BEGIN were to fail for some reason, the backend would skip the second
command altogether, since it would skip to the Sync before resuming
processing messages. If the JDBC driver isn't expecting that behavior,
that's a bug in the driver --- but it's not a protocol violation. In
fact, the protocol is intentionally designed to let you stack up commands
like that. It gives you a tradeoff of potential concurrency vs possible
complexity in error recovery handling.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-08-31 00:53:57 Re: Horizontal scalability/sharding
Previous Message Tom Lane 2015-08-30 23:16:26 Re: icc vs. gcc-style asm blocks ... maybe the twain can meet?