Test case (re: A JDBC bug or problem relating to string length in Java)

From: joe user <palehaole(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Test case (re: A JDBC bug or problem relating to string length in Java)
Date: 2003-09-02 03:28:36
Message-ID: 20030902032836.40676.qmail@web20421.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello, I have created a reproducible test case for the
behavior I was describing, where Java thinks the
string length is one thing but PG thinks it is
something else (longer) throwing an SQLException. I'm
not sure where the bug is, but it's a real bug and
it's somewhere. I have attached the test case as a
file. I would appreciate it if someone else could
verify that he sees this behavior and that it is a
bug.

Test details:

Tested on both Redhat 9, and SuSE 8.2
Sun JDK 1.4.2
Postgres 7.3.4, with the JDBC that comes with it

Linux was installed "plain vanilla". If anyone has
questions about my Linux environment I can answer
them. Postgres was compiled also "plain vanilla",
like this:

./configure --with-java
make

and that is all.

The output that I get from my test program is this:

% java SqlClientTest
The length of the evil string is: 99
Exception in thread "main" java.sql.SQLException:
ERROR: value too long for type character varying(100)

Clearly, Java thinks the string is 99 chars, and
Postgres thinks it is longer than 100 chars. Any
feedback or information about this would be most
welcome, especially any suggestions of fixes or
workarounds.

Thanks!

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Attachment Content-Type Size
SqlClientTest.java text/x-java 2.4 KB

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Michael Stephenson 2003-09-02 09:22:37 Re: A JDBC bug or problem relating to string length in Java
Previous Message Jean-Christian Imbeault 2003-09-02 03:23:56 Re: A JDBC bug or problem relating to string length in Java