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

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Problems with question marks in operators (JDBC, ECPG, ...)
Date: 2015-05-19 19:04:56
Message-ID: 3a488a49b408c6d1085ee8ba1e93950e@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Bruno Harbulot asked for a devil's advocate by saying:
> My main point was that this is not specific to JDBC. Considering that even
> PostgreSQL's own ECPG is affected, the issue goes probably deeper than it
> seems. I'm just not convinced that passing the problem onto connectors,
> libraries and ultimately application developers is the right thing to do
> here.

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...

> Recommending that all drivers implement \? as a semi-standard workaround is
> actually a much more difficult problem than it seems: it requires following
> the development of each project, making the case to each community
> (assuming they're all open source), and reasonable in-depth knowledge of
> their respective implementation, also assuming that \? won't cause further
> problems there (of course, all that is easier if you're already working on
> that particular project).

That's actually where we are right now. And it's not really our job to
make the case to each community - it is the responsibility of each project
to solve the problem, presumably because of pressure from their users.
The "\?" would only be a recommendation (but a pretty good one - the Perl
folk talked a good bit about the best solution and researched if \? had
the potential to cause any other problems).

> Even according to what you're saying this issue has required a first
> workaround back in 2008, and another one earlier this year, probably due to
> concerns that weren't spotted when implementing the first workaround (this
> also presumably requires users to run a fairly recent version of this
> connector now).

True enough regarding the two changes. But the system worked well, in that
someone had a problem, raised a bug, and it got fixed. I'm not sure I see
the point about requiring recent versions of the connector - that's true
for lots of bug fixes and features. This one at least is fairly optional
with many existing workarounds (e.g. use $1, quote things in a different way).

> (It looks like PHP/PDO is another one to add to the list:
> https://bugs.php.net/bug.php?id=62493, it's been open for almost 3 years.)

Some days I almost feel sorry for PHP.

- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 201505191503
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAlVbiRUACgkQvJuQZxSWSsjHYgCg1GfnDrdefkoedpigxYiuBMFX
794An3XWPXA0dVRk0JI6/Ik5Jb7SOLO7
=Amfe
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2015-05-19 19:11:33 Re: INSERT ... ON CONFLICT DO UPDATE with _any_ constraint
Previous Message Tom Lane 2015-05-19 19:02:03 Re: Problems with question marks in operators (JDBC, ECPG, ...)