Re: [JDBC] JDBC and Binary protocol error, for some statements

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: Maciek Sakrejda <msakrejda(at)truviso(dot)com>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL JDBC List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [JDBC] JDBC and Binary protocol error, for some statements
Date: 2010-11-24 18:18:40
Message-ID: 201011241918.40930.rsmogura@softperience.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

I didn't described log correctly, 1st attached response is normal execution;
flags QUERY_SUPPRESS_BEGIN | QUERY_ONESHOT, 2nd is compiled statement
QUERY_SUPPRESS_BEGIN only.

Text format is marked as 0, binary format is 1.

The 1st shown execution (flags=17) is good, it tells that result is sended in
binary format, as int4, but 2nd one (flags=16) (statement compiled) result is
bad because

Server described row as text
07:52:06.061 (54) <=BE RowDescription(1)
07:52:06.061 (54) Field(,INT4,4,T)
but recieved "tuple" was clearly in binary format, 0x00, 0x00, 0x00, 0x02.
(Look at length should be 1 or 2 if it's text format and value 2)
Speaking it simple, server said "you will recive text data", but sent it as
binary encoded int.

I've checked this againt 8.4 and 9.0.1.

Maciek Sakrejda <msakrejda(at)truviso(dot)com> Wednesday 24 November 2010 18:02:27
> >Result is oid=23, format=(0) T, value = 0x00,0x00,0x00,0x02
>
> What do you mean regarding the format? Are you just inferring that
> from the data? If memory serves, the format of a particular column is
> not specified anywhere other than the RowDescription, and according to
> your JDBC log output above, the server is telling you the format is
> text (1) (which is your point--it doesn't match the resulting
> data--but I want to make sure we're clear on what's actually going
> on).

It's jdbc2.PreparedStatementTest, form JDBC driver unit tests. I've exposed
sources here http://www.rsmogura.net/pgsql/pgjdbc_exp_20101124.tar.gz
compiled driver and unit tests are in parent directory.
In above all not related to this bug tests has been commented, just run ant
test.
> Also, can you narrow this down to a simple, self-contained test case
> (with code)? Even if it's against a custom driver build, that would be
> easier to investigate.
> ---
> Maciek Sakrejda | System Architect | Truviso
>
> 1065 E. Hillsdale Blvd., Suite 215
> Foster City, CA 94404
> (650) 242-3500 Main
> www.truviso.com

Kind regards,
Radek

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-11-24 18:20:36 Re: profiling connection overhead
Previous Message Stefan Kaltenbrunner 2010-11-24 18:16:20 Re: 8.4-vintage problem in postmaster.c

Browse pgsql-jdbc by date

  From Date Subject
Next Message Maciek Sakrejda 2010-11-24 18:25:27 Re: [JDBC] JDBC and Binary protocol error, for some statements
Previous Message Maciek Sakrejda 2010-11-24 17:02:27 Re: [JDBC] JDBC and Binary protocol error, for some statements