Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id A799E9FB537 for ; Thu, 19 Jul 2007 09:35:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 75399-05 for ; Thu, 19 Jul 2007 09:34:58 -0300 (ADT) X-Greylist: delayed 00:07:49.15656 by SQLgrey-1.7.5 Received: from gw02.mail.saunalahti.fi (gw02.mail.saunalahti.fi [195.197.172.116]) by postgresql.org (Postfix) with ESMTP id 553669FB52B for ; Thu, 19 Jul 2007 09:35:03 -0300 (ADT) Received: from [10.0.0.4] (a88-113-10-143.elisa-laajakaista.fi [88.113.10.143]) (using SSLv3 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by gw02.mail.saunalahti.fi (Postfix) with ESMTP id 56F131393F4; Thu, 19 Jul 2007 15:27:08 +0300 (EEST) Subject: Re: Status of binary protocol usage? From: Mikko Tiihonen To: Tom Lane , aaime74 Cc: pgsql-jdbc@postgresql.org Content-Type: text/plain Date: Thu, 19 Jul 2007 15:27:08 +0300 Message-Id: <1184848028.1632.25.camel@dual.local> Mime-Version: 1.0 X-Mailer: Evolution 2.10.2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200707/92 X-Sequence-Number: 17266 tom lane wrote: > aaime74 writes: > > Hum, interesting. What would be the boatload of disadvantages? > > Portability and cross-machine compatibility, or lack of same. I can understand that future postgres versions can change the binary protocol, but I hope it is done so that it can be deduced from the version or alternatively similarly to the float/long timestamp so that the server informs about its usage of new features. But I cannot understand why the protocol would be allowed to ever vary with the server 32/64bitness or endiandness. And at least to my current understanding it doesn't. And if those are taken care of in the server side then there shouldn't be any problems because the java side by definition already is cross-machine compatible and portable. But if you really think that the binary protocol varies so much with the server then why is it documented (even as much as it is) and why is the documentation warning about the possible compatibility problems. > It's tough enough trying to make things work for relatively primitive > datatypes like float. I can hardly imagine that anyone would want to > support binary representations across platforms for geometric types. I think that is why the postgres binary protocol allows requesting use of binary types for each input and output parameter separately. In addition the jdbc driver (with my proposed patches) allows controlling binary/text format of each type separately to work around any future changes in the protocol. In the proposed binary protocol changes one just needs to add a few lines code to send or receive path (which ever is the bottleneck) whenever a new datatype that is performance critical for an application is found. Anyway, I seem to have vanished for half a year but I could try to pick up things from where I left them. Kris had some good ideas on how to hack the test framework in order to ensure that the binary patches would not cause any regressions. -Mikko