NOT EXIST for PREPARE

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема NOT EXIST for PREPARE
Дата
Msg-id CAHyXU0wHYEEyDuOUeLhEyNG5vN_69uyrsf0THFhasQ8Wve8vTg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: NOT EXIST for PREPARE  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Tue, Mar 22, 2016 at 9:53 AM, Andres Freund <andres@anarazel.de> wrote:
> On 2016-03-22 09:37:15 -0500, Merlin Moncure wrote:
>> On Tue, Mar 22, 2016 at 8:01 AM, Andres Freund <andres@anarazel.de> wrote:
>> > Hi,
>> > On 2016-03-22 12:41:43 +0300, Yury Zhuravlev wrote:
>> >> Do I understand correctly the only way know availability PREPARE it will
>> >> appeal to pg_prepared_statements?
>> >> I think this is not a good practice. In some cases, we may not be aware of
>> >> the PREPARE made (pgpool). Moreover, it seems popular question in the
>> >> Internet: http://stackoverflow.com/questions/1193020/php-postgresql-check-if-a-prepared-statement-already-exists
>> >>
>> >> What do you think about adding NOT EXIST functionality to PREPARE?
>> >
>> > Not very much. If you're not in in control of the prepared statements, you
>> > can't be sure it's not an entirely different statement. So NOT EXISTS
>> > doesn't really buy you anything, you'd still need to compare the
>> > statement somehow.
>>
>> Strongly disagree!  A typical use case of this feature would be in
>> connection pooler scenarios where you *are* in control of the
>> statement but it's a race to see who creates it first.  This feature
>> should be immediately be incorporated by the JDBC driver so that we'd
>> no longer have to disable server side prepared statements when using
>> pgbounder (for example).
>
> Uh. JDBC precisely is a scenario where that's *NOT* applicable? You're
> not in control of the precise prepared statement names it generates, so
> you have no guarantee that one prepared statement identified by its name
> means the same in another connection.

The name is under control of the JDBC driver, and there are simple strategies to make the name global assuming the app did not pass the name.  So it should work.

merlin

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

Предыдущее
От: Yury Zhuravlev
Дата:
Сообщение: Re: NOT EXIST for PREPARE
Следующее
От: Teodor Sigaev
Дата:
Сообщение: Re: [PATCH] we have added support for box type in SP-GiST index