Re: disable prompting by default in createuser

Поиск
Список
Период
Сортировка
От Josh Kupershmidt
Тема Re: disable prompting by default in createuser
Дата
Msg-id CAK3UJRE-AZpjEHxCMia7fMzgavdRY64DY=BwNvXegweKy8hzDQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: disable prompting by default in createuser  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: disable prompting by default in createuser  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
On Thu, Dec 22, 2011 at 2:26 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> On lör, 2011-11-26 at 01:28 +0200, Peter Eisentraut wrote:
>> I propose that we change createuser so that it does not prompt for
>> anything by default.  We can arrange options so that you can get prompts
>> for whatever is missing, but by default, a call to createuser should
>> just run CREATE USER with default options.  The fact that createuser
>> issues prompts is always annoying when you create setup scripts, because
>> you have to be careful to specify all the necessary options, and they
>> are inconsistent and different between versions (although the last
>> change about that was a long time ago), and the whole behavior seems
>> contrary to the behavior of all other utilities.  I don't think there'd
>> be a real loss by not prompting by default; after all, we don't really
>> want to encourage users to create more superusers, do we?  Comments?
>
> Patch attached.  I'll add it to the next commitfest.

I looked at this patch for the 2012-01 CF. I like the idea, the
interactive-by-default behavior of createuser has always bugged me as
well.

I see this patch includes a small change to dropuser, to make the
'username' argument mandatory if --interactive is not set, for
symmetry with createuser's new behavior. That's dandy, though IMO we
shouldn't have "-i" be shorthand for "--interactive" with dropuser,
and something different with createuser (i.e. we should just get rid
of the "i" alias for dropuser).

Another little inconsistency I see with the behavior when no username
to create or drop is given:

$  createuser
createuser: creation of new role failed: ERROR:  role "josh" already exists
$ dropuser
dropuser: missing required argument role name
Try "dropuser --help" for more information.

i.e. createuser tries taking either $PGUSER or the current username as
a default user to create, while dropuser just bails out. Personally, I
prefer just bailing out if no create/drop user is specified, but
either way I think they should be consistent.

Oh, and I think the leading whitespace of this help message:
   printf(_("      --interactive         prompt for missing role name
and attributes rather\n"

should be made the same as for other commands with no short-alias, e.g.
   printf(_("  --replication             role can initiate replication\n"));

Other than those little complaints, everything looks good.

Josh


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: SKIP LOCKED DATA
Следующее
От: Jeff Janes
Дата:
Сообщение: Memory usage during sorting