Re: [HACKERS] JDBC and Binary protocol error, for some statements - Mailing list pgsql-jdbc

From Radosław Smogura
Subject Re: [HACKERS] JDBC and Binary protocol error, for some statements
Date
Msg-id e3a52d52a67f7c30f9a3127b9bfbe6a3@smogura-softworks.eu
Whole thread Raw
In response to Re: [HACKERS] JDBC and Binary protocol error, for some statements  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] JDBC and Binary protocol error, for some statements  (Maciek Sakrejda <msakrejda@truviso.com>)
List pgsql-jdbc
Hi,

Thank you for your response.

I would only ask to be sure...
So, to summarise, I shouldn't believe server DescribeRow (in context of
format), in this situation, but only I should look at this what I asked
for, isn't it? If I asked for columns in binary format, I need to do binary
reading regarding what server has responded? If I asked for odd columns in
text, even in binary do I need to choose proper format basing only on my
request?

But to the last part of cited protocol specification, when I've sent
message with statement parameter's type int4, int8, varchar the format
field wasn't set to 0, but 1.

Kind regards,
Radosław Smogura

On Thu, 25 Nov 2010 12:23:03 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> AFAICS this isn't a bug.  What you're issuing Describe against is the
> prepared statement, not the portal.  The result column formats are not
> specified by a prepared statement, so Describe just returns zeroes for
> them.  Result column formats are specified by the Bind command, which
> creates a Portal.  If you'd issued the Describe against the Portal, you
> should get back the correct format codes.  Per the protocol
> specification:
>
>     The Describe message (statement variant) specifies the name of an
>     existing prepared statement (or an empty string for the unnamed
>     prepared statement). The response is a ParameterDescription message
>     describing the parameters needed by the statement, followed by a
>     RowDescription message describing the rows that will be returned
>     when the statement is eventually executed (or a NoData message if
>     the statement will not return rows). ErrorResponse is issued if
>     there is no such prepared statement. Note that since Bind has not
>     yet been issued, the formats to be used for returned columns are not
>     yet known to the backend; the format code fields in the
>     RowDescription message will be zeroes in this case.
>
> Now, if there's something in the JDBC driver that expects
> DescribeStatement to return useful result format codes, that'd be
> a bug in the driver.
>
>             regards, tom lane

--
----------
Radosław Smogura
http://www.softperience.eu

pgsql-jdbc by date:

Previous
From: Maciek Sakrejda
Date:
Subject: Re: [HACKERS] JDBC and Binary protocol error, for some statements
Next
From: Samuel Gendler
Date:
Subject: Re: Problem with COPY using PostgreSQL 9 and JDBC 4