JDBC and Binary protocol error, for some statements - Mailing list pgsql-hackers

From Radosław Smogura
Subject JDBC and Binary protocol error, for some statements
Date
Msg-id a7d41aaa473a1a4c38e04796b9f3ac36@smogura-softworks.eu
Whole thread Raw
Responses Re: [JDBC] JDBC and Binary protocol error, for some statements  (Maciek Sakrejda <msakrejda@truviso.com>)
List pgsql-hackers
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.postgresql.jdbc2.AbstractJdbc2Statement$StatementResultHandler@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.postgresql.jdbc2.AbstractJdbc2Statement$StatementResultHandler@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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Suggested "easy" TODO: pg_dump --from-list
Next
From: Heikki Linnakangas
Date:
Subject: Re: profiling connection overhead