From: Kris Jurka <books@ejurka.com>
To: Alexandre de Arruda Paes <adaldeia@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Automatic cast
Date: Thu, 18 May 2006 17:21:56 -0500 (EST)
Message-ID: <Pine.BSO.4.63.0605181718180.17035@leary2.csoft.net> (raw)
In-Reply-To: <fe86db180605181511y1980e6f0x74d77d519b5201d5@mail.gmail.com>
References: <fe86db180605181511y1980e6f0x74d77d519b5201d5@mail.gmail.com>
On Thu, 18 May 2006, Alexandre de Arruda Paes wrote:
> I have a problem and I want know if this can be solved in the jdbc driver.
> Our company develop softwares using a CASE Tool caled Genexus. The
> SQL sintaxe are not changeable and they have a big problem: the querys
> aren't casted.
>
> SELECT field from table where field=10
>
> If the field are int2 or int8, PostgreSQL don't use indexes (its
> converts the value 10 to int4).
This should work fine in 8.0 and up when cross type index access was
added. If you're not using 8.0+ consider an upgrade. If you are using
8.0+ please provide more details about your problem.
> Can I put an implicit (automatic) cast (' ' - apostrofes) in the SQL
> sintaxes passed throught JDBC ???
You can write:
SELECT field FROM table WHERE field = ?::int8
or
SELECT field FROM table WHERE field = CAST(? AS int8);
Kris Jurka
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: books@ejurka.com, adaldeia@gmail.com
Subject: Re: Automatic cast
In-Reply-To: <Pine.BSO.4.63.0605181718180.17035@leary2.csoft.net>
References: <fe86db180605181511y1980e6f0x74d77d519b5201d5@mail.gmail.com> <Pine.BSO.4.63.0605181718180.17035@leary2.csoft.net>
* 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