BIGINT <-> java.lang.String auto cast - Mailing list pgsql-jdbc

From Sergey A. Sokolov
Subject BIGINT <-> java.lang.String auto cast
Date
Msg-id !~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAA9SYzpt7NMkKw9lNuhI5QK8KAAAAQAAAAnBWwdiZAtku5jF+VUp/+6gEAAAAA@xtech.ru
Whole thread Raw
Responses Re: BIGINT <-> java.lang.String auto cast
List pgsql-jdbc
Hello all,

I would appreciate if JDBC development team consider my message as a feature
request for Postgres JDBC 8.xx drivers.

My issue is the following: in our application we use java.lang.String for
holding Identifier values of the database objects (portability,
extensibility, etc...), while PostgreSQL schema implementation have ID
fields as BIGINT's (or BIGSERIAL's) for most of the objects. We use some
stored procedures/functions in order to access and modify the data and,
certainly, have to pass ID values there from Java.

We use "PreparedStatement.setString(index, id);"-like statements in Java for
this kind of fields and everything works fine with JDBC drivers version 7.4
-- I mean autocast works and stored procedure/function is being found and
called correctly.
When we moved to Postgres JDBC version 8.0, or 8.1dev -- we've ran into the
problem of getting exceptions like

org.postgresql.util.PSQLException: ERROR: function proc_test(character
varying) does not exist

Attached is the test case for this issue. We use PostgreSQL database server
v 8.0.2.

I don't think this new behaviour is the correct one as BIGINT can be
serialised and deserialised back to String nicely and sometimes it is the
only way of passing data in heterogeneous systems.


Thank you for your time,

Sergey A. Sokolov
xTech Ltd.

--
| E-mail: abac@xtech.ru;  URL: http://www.xtech.ru
| P.O. Box 567, Novosibirsk-117, 630117, Russia
| Tel/Fax:   +7 383-2 329-658
| Our local time zone is GMT+7 (Summer time).


Attachment

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: [HACKERS] IN/OUT parameters
Next
From: Roland Walter
Date:
Subject: Re: BIGINT <-> java.lang.String auto cast