Re: Problems with question marks in operators (JDBC, ECPG, ...)

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: Problems with question marks in operators (JDBC, ECPG, ...)
Дата
Msg-id CADK3HH+YKA_4iiF4zRB_hC9_XXOYSuGyNgZNkR4cTo9+9Ja7FQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Problems with question marks in operators (JDBC, ECPG, ...)  (Jan de Visser <jan@de-visser.net>)
Ответы Re: Problems with question marks in operators (JDBC, ECPG, ...)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers

On 19 May 2015 at 19:18, Jan de Visser <jan@de-visser.net> wrote:
On May 19, 2015 09:31:32 PM Greg Sabino Mullane wrote:
> Jan de Visser wrote:
> >> Well, one could argue that it *is* their problem, as they should be using
> >> the standard Postgres way for placeholders, which is $1, $2, $3...
> >
> > Shirley you are joking: Many products use JDBC as an abstraction layer
> > facilitating (mostly) seamless switching between databases. I know the
> > product I worked on did. Are you advocating that every single statement
> > should use "SELECT * FROM foo WHERE bar = $1" on pg and "SELECT * FROM
> > foo WHERE bar = ?" on every other database?
>
> I'm not joking, and don't call me Shirley. If you are running into
> situations where you have question mark operators in your queries, you have
> already lost the query abstraction battle. There will be no seamless
> switching if you are using jsonb, hstore, ltree, etc. My statement was more
> about pointing out that Postgres already offers a complete placeholder
> system, which drivers are free to implement if they want.

I must have misunderstood you <strike>Shirley</strike> Greg, because to me it
parsed as if you were suggesting (paraphrasing) "ah forget about those pesky
standardized drivers and their pesky syntax requirements. Just use ours like a
big boy".

I understand that once you start using '?' as (part of) operator names in your
queries you're not portable anymore. I just thought that your proposed
solution was to throw all portability out the window. But I was probably
(hopefully?) wrong.

jan



Using anything other than ? in JDBC is a non-starter you might as well just stop supporting java entirely.

Back to the issue at hand. Does anyone have a recommendation for a replacement operator besides ?

When I first noticed this one thought was to create duplicate operators specifically for the use of the JDBC driver. 

I had dismissed this at the time, now I'm not so sure

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

 

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

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

Предыдущее
От: David Steele
Дата:
Сообщение: Re: Change pg_cancel_*() to ignore current backend
Следующее
От: Srinivas Karthik V
Дата:
Сообщение: PostgreSQL 8.3 index page count clarification