Re: Automatic cast

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: Automatic cast
Дата
Msg-id Pine.BSO.4.63.0605181718180.17035@leary2.csoft.net
обсуждение исходный текст
Ответ на Automatic cast  ("Alexandre de Arruda Paes" <adaldeia@gmail.com>)
Список pgsql-jdbc

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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Alexandre de Arruda Paes"
Дата:
Сообщение: Automatic cast
Следующее
От: "sathish kumar shanmugavelu"
Дата:
Сообщение: Re: jdbc driver problem?