Re: NOT EXIST for PREPARE

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Tatsuo Ishii <ishii(at)postgresql(dot)org>
Subject: Re: NOT EXIST for PREPARE
Date: 2016-03-23 16:16:28
Message-ID: CAHyXU0wsZ4_uosLOPHvOvx5KOFE+wOewmEw8SV4W4=wkecga2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 23, 2016 at 8:21 AM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> I'm not understanding the objection at all. You have N client
> sessions connecting to the database that all utilize the same named
> prepared statement. A typical pattern is for the application to
> prepare them all upon startup, but currently each PREPARE needs to be
> wrapped with an exception handler in case someone else prepared it
> first. Having an IF NOT EXISTS decoration simplifies this. This can
> happen both inside and outside of connection pooling scenarios.

I'm walking that back a bit -- this is only interesting in pooler
scenarios, especially pgbouncer where you have no way of knowing if
the statement is created or not. Of course, you can always re-prepare
them following a discard but that's quite pessimal in many cases.
Still, I've often wanted this exact feature.

merlin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2016-03-23 16:19:02 Re: Re: Missing rows with index scan when collation is not "C" (PostgreSQL 9.5)
Previous Message Tom Lane 2016-03-23 16:13:45 Re: Re: Missing rows with index scan when collation is not "C" (PostgreSQL 9.5)