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

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Maciek Sakrejda <msakrejda(at)truviso(dot)com>, 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-25 18:56:36
Message-ID: e3a52d52a67f7c30f9a3127b9bfbe6a3@smogura-softworks.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-11-25 19:09:42 Re: reporting reason for certain locks
Previous Message Maciek Sakrejda 2010-11-25 18:20:34 Re: [JDBC] JDBC and Binary protocol error, for some statements

Browse pgsql-jdbc by date

  From Date Subject
Next Message Samuel Gendler 2010-11-25 19:11:04 Re: Problem with COPY using PostgreSQL 9 and JDBC 4
Previous Message Maciek Sakrejda 2010-11-25 18:20:34 Re: [JDBC] JDBC and Binary protocol error, for some statements