Re: IF [NOT] EXISTS for replication slots

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: IF [NOT] EXISTS for replication slots
Date: 2017-02-07 00:00:02
Message-ID: CAB7nPqTX4h340LTB-tJygW3t2FcX=9nZtYuAGZP1rnGaO6Ad3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 7, 2017 at 2:07 AM, Petr Jelinek
<petr(dot)jelinek(at)2ndquadrant(dot)com> wrote:
> On 06/02/17 05:15, Michael Paquier wrote:
>> Hi all,
>>
>> Lately I have bumped into a case where it would have been useful to
>> make the difference between a failure because of a slot already
>> dropped and an internal failure of Postgres. Is there any interest for
>> support of IE and INE for CREATE and DROP_REPLICATION_SLOT?
>> My use case involved only the SQL-callable interface, but I would
>> think that it is useful to make this difference as well with the
>> replication protocol. For the function we could just add a boolean
>> argument to control the switch, and for the replication commands a
>> dedicated keyword.
>>
>> Any thoughts?
>
> My thought is, how would this handle the snapshot creation that logical
> slot does when it's created?

In what is that related to IF NOT EXISTS? If the slot does not get
created you could just return NULL to the caller to let him know that
there is something already around. The use-case I have found INE
useful involved physical slots actually.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2017-02-07 00:36:33 Re: asynchronous execution
Previous Message Corey Huinker 2017-02-06 22:49:17 Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)