JDBC and Binary protocol error, for some statements

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL JDBC List <pgsql-jdbc(at)postgresql(dot)org>
Subject: JDBC and Binary protocol error, for some statements
Date: 2010-11-24 07:07:07
Message-ID: a7d41aaa473a1a4c38e04796b9f3ac36@smogura-softworks.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

Hi,

I work on implementing binary protocol, during test "select ?::int" has
been
executed few times to compile it to server prepared statement, but after
this
backend returned field format = text, but sent field data in binary mode.

The parameter is long and is sent to in text mode, with oid 0, as value
"2"
Result is oid=23, format=(0) T, value = 0x00,0x00,0x00,0x02

When I send parameter explicite in binary mode and int4 oid, problem
doesn't
occurs.

Here is debug of protocol

---------------------------------------
07:52:02.995 (54) simple execute,
handler=org(dot)postgresql(dot)jdbc2(dot)AbstractJdbc2Statement$StatementResultHandler(at)508aeb74,

maxRows=0, fetchSize=0, flags=17
07:52:02.996 (54) FE=> Parse(stmt=null,query="SELECT $1::int",oids={0})
07:52:02.996 (54) FE=> Bind(stmt=null,portal=null,$1=<'2'>)
07:52:02.996 (54) FE=> Describe(portal=null)
07:52:02.996 (54) FE=> Execute(portal=null,limit=0)
07:52:02.996 (54) FE=> Sync
07:52:02.997 (54) <=BE ParseComplete [null]
07:52:02.997 (54) <=BE BindComplete [null]
07:52:02.998 (54) <=BE RowDescription(1)
07:52:02.998 (54) Field(,INT4,4,B)
07:52:02.998 (54) <=BE DataRow(len=4)
07:52:02.998 (54) <=BE CommandStatus(SELECT)
07:52:02.999 (54) <=BE ReadyForQuery(I)

---------------------------------------
Compiled stat exec
07:52:06.059 (54) simple execute,
handler=org(dot)postgresql(dot)jdbc2(dot)AbstractJdbc2Statement$StatementResultHandler(at)128ae45a,

maxRows=0, fetchSize=0, flags=16
07:52:06.059 (54) FE=> Parse(stmt=S_1,query="SELECT $1::int",oids={0})
07:52:06.059 (54) FE=> Describe(statement=S_1)
07:52:06.060 (54) FE=> Bind(stmt=S_1,portal=null,$1=<'2'>)
07:52:06.060 (54) FE=> Execute(portal=null,limit=0)
07:52:06.060 (54) FE=> Sync
07:52:06.060 (54) <=BE ParseComplete [S_1]
07:52:06.061 (54) <=BE ParameterDescription
07:52:06.061 (54) <=BE RowDescription(1)
07:52:06.061 (54) Field(,INT4,4,T)
07:52:06.061 (54) <=BE BindComplete [null]
07:52:06.061 (54) <=BE DataRow(len=4)
07:52:06.062 (54) <=BE CommandStatus(SELECT)
07:52:06.062 (54) <=BE ReadyForQuery(I)
org.postgresql.jdbc4.exceptions.PSQLDataException: Zła wartość dla typu
int:

Kind regards,
Radek

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2010-11-24 07:10:37 Re: profiling connection overhead
Previous Message Tom Lane 2010-11-24 06:15:43 Re: Suggested "easy" TODO: pg_dump --from-list

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2010-11-24 07:43:17 Re: getTables() doesn't handle umlauts correctly
Previous Message Kris Jurka 2010-11-24 06:31:13 Re: bit datatype and getObject()