From: boris <boris@localhost.localdomain>
To: pgsql-jdbc@postgresql.org
Subject: Re: jdbc and automagic casting
Date: Mon, 19 Sep 2011 11:47:37 -0400
Message-ID: <j57o4a$67k$1@speranza.aioe.org> (raw)
References: <419cf418-a33a-4c61-858c-208bf5d55844@g30g2000yqc.googlegroups.com>
On 09/19/2011 10:39 AM, Guillaume wrote:
> Hello,
>
> I have an INSERT which does not behave the same under jdbc and psql.
>
> With psql, INSERTing a poperly formed VARCHAR into an inet column
> would work, eg.:
>
> =# \d user_record;
> Table "user_record"
> Column | Type | Modifiers
> ----------------------+------------------------+-----------
> id | integer |
> username | character varying(64) |
> registered_ip | inet |
>
> INSERT INTO user_record (0, 'abc', '127.0.0.1') is valid and works.
> The string is automagically casted as an inet value.
>
> Using jdbc, this is not the case, and causes me loads of trouble (and
> exceptions).
> Is there a way around it?
>
> I do not have access to the java source code, there is thus no way to
> update the code to programatically force a CAST.
do you know if they used preparedstatement or build dynamic sql?
for now , I'm not sure if it would make a difference in this case..
>
> Thanks for any help,
> Guillaume
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: boris@localhost.localdomain
Subject: Re: jdbc and automagic casting
In-Reply-To: <j57o4a$67k$1@speranza.aioe.org>
References: <419cf418-a33a-4c61-858c-208bf5d55844@g30g2000yqc.googlegroups.com> <j57o4a$67k$1@speranza.aioe.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox