Re: Extra functionality to createuser

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Christopher Browne <cbbrowne(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Sameer Thakur <samthakur74(at)gmail(dot)com>, PostgreSQL Mailing Lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Extra functionality to createuser
Date: 2013-11-18 06:01:54
Message-ID: CAA4eK1+Hni4RnMdtQ=fwT7aKLO70uisaE5cBQbhRp2PNrGew1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 16, 2013 at 4:57 AM, Christopher Browne <cbbrowne(at)gmail(dot)com> wrote:
> On Fri, Nov 15, 2013 at 3:14 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>> On 11/14/13, 4:35 PM, Christopher Browne wrote:> On Thu, Nov 14, 2013 at
>> 5:41 AM, Sameer Thakur <samthakur74(at)gmail(dot)com> wrote:
>>>> So i think -g option is failing
>>>
>>> Right you are.
>>>

This patch adds useful option '-g' to createuser utility which will
allow user to make new roles as member of existing roles and the same
is already possible by Create Role/User syntax.

Few comments:

1.
+ <term><option>-g</></term>
+ <term><option>--roles</></term>

All other options which require argument are of form:
<term><option>-c <replaceable class="parameter">number</replaceable></></term>
<term><option>--connection-limit=<replaceable
class="parameter">number</replaceable></></term>

So I think it is better to have this new option which require argument
in similar form.

2.
+ Indicates roles to associate with this role.

I think word associate is not very clear, wouldn't it be better to
mention that this new role will be member of roles specified.
For example:
Indicates roles to which the new role will be immediately added as a new member.

3.
+ case 'g':
+ roles = pg_strdup(optarg);
+ break;

If we see most of other options in case handling are ordered as per
their order in long_options array. For example

static struct option long_options[] = {
{"host", required_argument, NULL, 'h'},
{"port", required_argument, NULL, 'p'},
..

Now the order of handling for both is same in switch case or while get
opt_long() function call. I think this makes code easy to understand
and modify.
However there is no functionality issue here, so you can keep the code
as per your existing patch as well, this is just a suggestion.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexey Klyukin 2013-11-18 06:57:52 Re: Wildcard usage enhancements in .pgpass
Previous Message Sawada Masahiko 2013-11-18 05:53:20 Re: [PATCH] pg_basebackup: progress report max once per second