Re: pg_receivexlog --create-slot-if-not-exists

From: Cédric Villemain <cedric(at)2ndQuadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_receivexlog --create-slot-if-not-exists
Date: 2015-07-08 10:02:39
Message-ID: 559CF53F.10108@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Le 07/07/2015 14:55, Andres Freund a écrit :
> On 2015-06-19 17:21:25 +0200, Cédric Villemain wrote:
>>> To make slot usage in pg_receivexlog easier, should we add
>>> --create-slot-if-not-exists? That'd mean you could run the same command
>>> the first and later invocation.
>>
>> +1 (with a shorter name please, if you can find one... )
>
> How about a seperate --if-not-exists modifier? Right now --create works
> as an abbreviation for --create-slot, but --create-slot-if-not-exists
> would break that.

Having done a quick overview of other binaries provided by postgresql I
realized that pg_receivexlog is distinct from other tools creating
something at a sql level: for db, role and lang we have create and drop
as distinct commands. Both dropdb and dropuser have a '--if-exists'
(like in SQL) but have not for create operation.
Maybe we should have used createslot/dropslot in the first place and use
--if-exists --if-not-exists accordingly.
Having all in one tool, adding one or both options looks good to me.

The only alternative I see is more like "--force": return success even
if the operation was not required (create or drop).

--
Cédric Villemain +33 (0)6 20 30 22 52
http://2ndQuadrant.fr/
PostgreSQL: Support 24x7 - Développement, Expertise et Formation

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2015-07-08 11:57:26 expose confirmed_flush for replication slots
Previous Message Данила Поярков 2015-07-08 10:01:47 Re: Bypassing SQL lexer and parser