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

pg_receivexlog --create-slot-if-not-exists

From
Andres Freund
Date:
Hi,

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.

Greetings,

Andres Freund



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

From
Stephen Frost
Date:
* Andres Freund (andres@anarazel.de) 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.

Yes, please.
Thanks!
    Stephen

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

From
Magnus Hagander
Date:
On Fri, Jun 19, 2015 at 11:17 AM, Stephen Frost <sfrost@snowman.net> wrote:
* Andres Freund (andres@anarazel.de) 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.

Yes, please.


+1. 

--

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

From
Cédric Villemain
Date:
> 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... )

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



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

From
Andres Freund
Date:
On 2015-06-19 11:19:23 -0400, Magnus Hagander wrote:
> On Fri, Jun 19, 2015 at 11:17 AM, Stephen Frost <sfrost@snowman.net> wrote:
>
> > * Andres Freund (andres@anarazel.de) 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.
> >
> > Yes, please.
>
> +1.

Arguably we could do that for 9.5 - the whole slot stuff for receivexlog
is new, and this is just adjusting the API slightly. I won't fight much
for that opinion though.



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

From
Cédric Villemain
Date:

Le 19/06/2015 17:21, Andres Freund a écrit :
> On 2015-06-19 11:19:23 -0400, Magnus Hagander wrote:
>> On Fri, Jun 19, 2015 at 11:17 AM, Stephen Frost <sfrost@snowman.net> wrote:
>>
>>> * Andres Freund (andres@anarazel.de) 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.
>>>
>>> Yes, please.
>>
>> +1.
> 
> Arguably we could do that for 9.5 - the whole slot stuff for receivexlog
> is new, and this is just adjusting the API slightly. I won't fight much
> for that opinion though.

+1 for it in 9.5

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



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

From
Robert Haas
Date:
On Fri, Jun 19, 2015 at 12:00 PM, Cédric Villemain
<cedric@2ndquadrant.com> wrote:
> +1 for it in 9.5

If we can do it soon, sure.  But not in September.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

From
Andres Freund
Date:
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.



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

From
Cédric Villemain
Date:
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