Re: Feasibility of supporting bind params for all command types

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: Feasibility of supporting bind params for all command types
Дата
Msg-id 87b663faa5b362fdd37320a176e5afe9@biglumber.com
обсуждение исходный текст
Ответ на Re: Feasibility of supporting bind params for all command types  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


Tom Lane said:
...
> Craig Ringer <craig@2ndquadrant.com> writes:
>> While looking at an unrelated issue in PgJDBC I noticed that it's
>> difficult for users and the driver to tell in advance if a given
>> statement will support bind parameters.
>
> It's not that hard ;-) ... if it ain't SELECT/INSERT/UPDATE/DELETE,
> it won't accept parameters.

Yes, it is as easy as that. That's exactly what DBD::Pg does - looks 
at the first word of the statement. Although you also need to 
add VALUES and WITH to that list. :)

>> As a result, some code that worked with PgJDBC using the v2 protocol
>> will fail with the v3 protocol, e.g.
>>
>> It'd be nice not to force users to do their own escaping of literals in
>> non-plannable statements. Before embarking on anything like this I
>> thought I'd check and see if anyone's looked into supporting bind
>> parameters in utility statements, or if not, if anyone has any ideas
>> about the feasibility of adding such support.

I don't think that's a hill you want to conquer. Let that code 
relying on v2 behavior get rewritten, or make the driver smart 
enough to handle it automagically the best it can.

- -- 
Greg Sabino Mullane greg@turnstep.com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201410060710
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAlQyeNIACgkQvJuQZxSWSshYewCgg/EmgTbPp5KnfUpYfga8nsee
GVMAniXC+FxHFsiuT07idP8Tw70gCoBe
=a20X
-----END PGP SIGNATURE-----





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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pg_receivexlog and replication slots
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: WAL format and API changes (9.5)