Re: Using indices with long unique IDs. - Mailing list pgsql-general

From Greg Stark
Subject Re: Using indices with long unique IDs.
Date
Msg-id 87wu806enl.fsf@stark.xeocode.com
Whole thread Raw
In response to Using indices with long unique IDs.  ("Sergey Olefir" <so3lv@yahoo.com>)
List pgsql-general
"Sergey Olefir" <so3lv@yahoo.com> writes:

> Unfortunately neither of them seem to be portable (for example, the one with
> single quotes fails if I create PreparedStatement in Java:
> con.prepareStatement("SELECT * FROM table WHERE id='?'"); apparently Java
> doesn't parse question mark inside quotes).

That's wrong. You should not quote the ? in the query.

If the driver is textually substituting the argument (as was necessary in 7.3
and prior) then it probably ought to quote it. If it's not there should be an
option to tell it to quote even integer arguments.

If it's any consolation 7.5 will use the index even if you put a plain integer
in the query. If production is a long way off you could consider developing
against a CVS build today and plan to use 7.5 for production when it comes
out.

--
greg

pgsql-general by date:

Previous
From: "Aurangzeb M. Agha"
Date:
Subject: no space left on device
Next
From: "Joshua D. Drake"
Date:
Subject: Re: no space left on device