Re: new createuser option for replication role

Lists: pgsql-hackers
From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: new createuser option for replication role
Date: 2011-09-10 05:08:05
Message-ID: CAHGQGwEUTiqdHcr8QSLtahmFg3YvNJQd0OHK3ruE+UPdeissBQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

Currently createuser cannot create a role with REPLICATION privilege
because it doesn't have any option to do that. Which sometimes annoys
me when setting up replication. I'd like to propose to add new options
"-x (--replication)" and "-X (--no-replication)" into createuser. "-x" allows
the new user to do replication, and "-X" disallows. The default is "-X".
Is it worth creating the patch?

Though I'd like to use "-r" and "-R" as the option name, they have already
been used for CREATEROLE privilege. So I'm thinking to use "-x" and
"-X" derived from XLOG. But does anyone have better option name?

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: new createuser option for replication role
Date: 2011-09-10 06:15:15
Message-ID: CAHGQGwGwwreeOzRaLn22yBmBkuk_yjE-ayGbbbrJwj6k6V4HoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sat, Sep 10, 2011 at 2:08 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> Currently createuser cannot create a role with REPLICATION privilege
> because it doesn't have any option to do that. Which sometimes annoys
> me when setting up replication. I'd like to propose to add new options
> "-x (--replication)" and "-X (--no-replication)" into createuser. "-x" allows
> the new user to do replication, and "-X" disallows. The default is "-X".
> Is it worth creating the patch?

Patch attached.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachment Content-Type Size
createuser_replication_option_v1.patch application/octet-stream 3.6 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: new createuser option for replication role
Date: 2011-09-10 14:50:13
Message-ID: 1061.1315666213@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
> Currently createuser cannot create a role with REPLICATION privilege
> because it doesn't have any option to do that. Which sometimes annoys
> me when setting up replication. I'd like to propose to add new options
> "-x (--replication)" and "-X (--no-replication)" into createuser. "-x" allows
> the new user to do replication, and "-X" disallows. The default is "-X".
> Is it worth creating the patch?

> Though I'd like to use "-r" and "-R" as the option name, they have already
> been used for CREATEROLE privilege. So I'm thinking to use "-x" and
> "-X" derived from XLOG. But does anyone have better option name?

Better solution: don't have a short form of the switch.

regards, tom lane


From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: new createuser option for replication role
Date: 2011-09-11 01:45:48
Message-ID: CAHGQGwFWC05+06oN-LFFGbz0srnOZ_YT7d33C6U39oDcgHHZhw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sat, Sep 10, 2011 at 11:50 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
>> Currently createuser cannot create a role with REPLICATION privilege
>> because it doesn't have any option to do that. Which sometimes annoys
>> me when setting up replication. I'd like to propose to add new options
>> "-x (--replication)" and "-X (--no-replication)" into createuser. "-x" allows
>> the new user to do replication, and "-X" disallows. The default is "-X".
>> Is it worth creating the patch?
>
>> Though I'd like to use "-r" and "-R" as the option name, they have already
>> been used for CREATEROLE privilege. So I'm thinking to use "-x" and
>> "-X" derived from XLOG. But does anyone have better option name?
>
> Better solution: don't have a short form of the switch.

That sounds better. I revised the patch so that it adds only "--replication"
option to createuser.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachment Content-Type Size
createuser_replication_option_v2.patch application/octet-stream 2.6 KB

From: Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: new createuser option for replication role
Date: 2011-09-22 13:55:44
Message-ID: CAF6yO=2pz8Vr1kqVQky_viRv+3W-71E+tLfHNfNi_tHiwp2jnQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello

Before doing the complete review, I hit a regression with 9.1 createrole.

the command ''createuser -e -s foo" produce :
CREATE ROLE foo SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN NOREPLICATION;

before it was:
CREATE ROLE foo SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;

The REPLICATION was allowed by default to superuser, and the current
patch change the default to remove the right.

I believe we should add only the REPLICATION when --replication is
set, and NOREPLICATION when --no-replication is set.

2011/9/11 Fujii Masao <masao(dot)fujii(at)gmail(dot)com>:
> On Sat, Sep 10, 2011 at 11:50 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
>>> Currently createuser cannot create a role with REPLICATION privilege
>>> because it doesn't have any option to do that. Which sometimes annoys
>>> me when setting up replication. I'd like to propose to add new options
>>> "-x (--replication)" and "-X (--no-replication)" into createuser. "-x" allows
>>> the new user to do replication, and "-X" disallows. The default is "-X".
>>> Is it worth creating the patch?
>>
>>> Though I'd like to use "-r" and "-R" as the option name, they have already
>>> been used for CREATEROLE privilege. So I'm thinking to use "-x" and
>>> "-X" derived from XLOG. But does anyone have better option name?
>>
>> Better solution: don't have a short form of the switch.
>
> That sounds better. I revised the patch so that it adds only "--replication"
> option to createuser.
>
> Regards,
>
> --
> Fujii Masao
> NIPPON TELEGRAPH AND TELEPHONE CORPORATION
> NTT Open Source Software Center
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>

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


From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: new createuser option for replication role
Date: 2011-09-22 16:45:12
Message-ID: CAHGQGwGoBseB-XZGgYqT5_Pv5U-PotUOqeLysj8K+ggo2bGSmg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Sep 22, 2011 at 10:55 PM, Cédric Villemain
<cedric(dot)villemain(dot)debian(at)gmail(dot)com> wrote:
> Before doing the complete review, I hit a regression with 9.1 createrole.

Thanks!

> the command ''createuser -e -s foo" produce :
>  CREATE ROLE foo SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN NOREPLICATION;
>
> before it was:
>  CREATE ROLE foo SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;
>
> The REPLICATION was allowed by default to superuser, and the current
> patch change the default to remove the right.
>
> I believe we should add only the REPLICATION when --replication is
> set, and NOREPLICATION when --no-replication is set.

Agreed. Attached is the updated version of the patch. It adds two options
--replication and --no-replication. If neither specified, neither REPLICATION
nor NOREPLICATION is specified in CREATE ROLE, i.e., in this case,
replication privilege is granted to only superuser.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachment Content-Type Size
createuser_replication_option_v3.patch application/octet-stream 3.2 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: new createuser option for replication role
Date: 2011-09-23 13:29:01
Message-ID: CA+TgmoZofg-R-NVh-C59Se_ySroezZovOVpyupcTsoBCxyu4SQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Sep 22, 2011 at 12:45 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> Agreed. Attached is the updated version of the patch. It adds two options
> --replication and --no-replication. If neither specified, neither REPLICATION
> nor NOREPLICATION is specified in CREATE ROLE, i.e., in this case,
> replication privilege is granted to only superuser.

Committed. Do we need to make any changes in interactive mode, when
we prompt? In theory this could be either wanted or not wanted for
either superusers or non-superusers, but I'm not really sure it's
worth it, and I certainly don't want the command to go into
interactive mode just because neither --replication nor
--no-replication was specified.

Thoughts?

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


From: Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: new createuser option for replication role
Date: 2011-09-23 13:47:15
Message-ID: CAF6yO=2=ORKRG9K9W+=DQScevUG6udzmMXVxgaXncyu2vdm3EQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2011/9/23 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Thu, Sep 22, 2011 at 12:45 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>> Agreed. Attached is the updated version of the patch. It adds two options
>> --replication and --no-replication. If neither specified, neither REPLICATION
>> nor NOREPLICATION is specified in CREATE ROLE, i.e., in this case,
>> replication privilege is granted to only superuser.
>
> Committed.  Do we need to make any changes in interactive mode, when
> we prompt?  In theory this could be either wanted or not wanted for
> either superusers or non-superusers, but I'm not really sure it's
> worth it, and I certainly don't want the command to go into
> interactive mode just because neither --replication nor
> --no-replication was specified.
>
> Thoughts?

I believe the intereactive mode is useless.

There is still an issue with the patch for the documentation: a
superuser, even with NOREPLICATION is allowed to perform
pg_start_backup() and pg_stop_backup().

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

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


From: Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: new createuser option for replication role
Date: 2011-09-23 13:48:39
Message-ID: CAF6yO=0YkkNsRZAzVWzkpELUjbUrLRD6pw=ZfwGdJNqJ8yWUTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2011/9/23 Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>:
> 2011/9/23 Robert Haas <robertmhaas(at)gmail(dot)com>:
>> On Thu, Sep 22, 2011 at 12:45 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>> Agreed. Attached is the updated version of the patch. It adds two options
>>> --replication and --no-replication. If neither specified, neither REPLICATION
>>> nor NOREPLICATION is specified in CREATE ROLE, i.e., in this case,
>>> replication privilege is granted to only superuser.
>>
>> Committed.  Do we need to make any changes in interactive mode, when
>> we prompt?  In theory this could be either wanted or not wanted for
>> either superusers or non-superusers, but I'm not really sure it's
>> worth it, and I certainly don't want the command to go into
>> interactive mode just because neither --replication nor
>> --no-replication was specified.
>>
>> Thoughts?
>
> I believe the intereactive mode is useless.
>
> There is still an issue with the patch for the documentation: a
> superuser, even with NOREPLICATION is allowed to perform
> pg_start_backup() and pg_stop_backup().

noise, sorry
I've just read the commited patch which fixed that.

>
>
>>
>> --
>> Robert Haas
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
>
> --
> Cédric Villemain +33 (0)6 20 30 22 52
> http://2ndQuadrant.fr/
> PostgreSQL: Support 24x7 - Développement, Expertise et Formation
>

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


From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: new createuser option for replication role
Date: 2011-09-26 08:55:50
Message-ID: CAHGQGwG=JxwUdqWrNbzDos_er1Pd25f=OW=wgMUUT7vSK54pTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Sep 23, 2011 at 10:47 PM, Cédric Villemain
<cedric(dot)villemain(dot)debian(at)gmail(dot)com> wrote:
> 2011/9/23 Robert Haas <robertmhaas(at)gmail(dot)com>:
>> On Thu, Sep 22, 2011 at 12:45 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>> Agreed. Attached is the updated version of the patch. It adds two options
>>> --replication and --no-replication. If neither specified, neither REPLICATION
>>> nor NOREPLICATION is specified in CREATE ROLE, i.e., in this case,
>>> replication privilege is granted to only superuser.
>>
>> Committed.  Do we need to make any changes in interactive mode, when
>> we prompt?  In theory this could be either wanted or not wanted for
>> either superusers or non-superusers, but I'm not really sure it's
>> worth it, and I certainly don't want the command to go into
>> interactive mode just because neither --replication nor
>> --no-replication was specified.
>>
>> Thoughts?
>
> I believe the intereactive mode is useless.

Agreed. I think that a majority of "createuser" users are not interested
in REPLICATION privilege yet.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center