imlicit varchar truncation

From: "Pavel B(dot) Milovantsev" <pav(at)enterprisewizard(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: imlicit varchar truncation
Date: 2011-03-21 14:09:57
Message-ID: 1300716597.3957.17.camel@pavhome.intis.tomsk.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello.

I meet the difficulties with insert/update commands using Postgresql
JDBC driver.

Due to problems described previously at

> Re: value too long for type character varying(25) (http://archives.postgresql.org/pgsql-novice/2002-11/msg00166.php)

and

>Re: ParameterMetaData getPrecision() always zero? (http://archives.postgresql.org/pgsql-jdbc/2010-01/msg00077.php)

I have to perform an additional call to connection.getMetaData().getColumns()
in order to obtain the size of inserted/updated varchar field, and either
truncate the value at the client side, or make explicit truncations as shown
at (http://www.postgresql.org/docs/9.0/static/datatype-character.html)

The question is, are there any "standard" ways to avoid this excessive
call?
Have to say that a hand-made DB scheme caching is not the option.

Thank you in advance.
Pavel Milovantsev.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Sean Bowman 2011-03-21 15:55:30 Re: imlicit varchar truncation
Previous Message Vitalii Tymchyshyn 2011-03-21 10:47:50 Re: domains handling problem