[Pkg-postgresql-private] Re: Bug#224716: postgresql-client: createuser fails

simon raven simon@nuit.ca
Tue, 6 Jan 2004 15:19:15 +0000


Le Mon, Jan 05, 2004 at 23:17:41 +0100, Martin Pitt a �crit:
> Hi Simon, hi others!
> 
> On 2003-12-21 13:17 +0000, simon raven wrote:
> > (#:~)- createuser -E -U postgres -W nagios
> > Shall the new user be allowed to create databases? (y/n) n
> > Shall the new user be allowed to create more new users? (y/n) n
> > Password:
> > ERROR:  parser: parse error at or near "NOCREATEDB" at character 61
> > createuser: creation of user "nagios" failed
> > 
> > it fails if i include the -E (encrypt password) option, otherwise it
> > works as expected, if i do not include the -E option.
> 
> I debugged createuser.c and found the problem: giving the '-E' switch
> alone is not sufficient, you also must set the '-P' option to prompt
> for a password. '-W' asks for the password for connecting to the database,
> not for the user to be created.

i had tried with the -P on the first pass, but that was giving the
errors too (no i didn't make a note of it in my report, sorry :/). at
least i seem to remember having done that. i'll try with a dummy
postgres account... oh hmm, i guess not, though i am using a different
version of postgres than when i did this (7.39 iirc, vs. 7.4.1)

15:16:19 3687 simon@nuit% createuser -E -U postgres -W foo
Shall the new user be allowed to create databases? (y/n) n
Shall the new user be allowed to create more new users? (y/n) n
Password:
createuser: creation of new user failed: ERROR:  syntax error at or near "NOCREATEDB" at character 27
(3 ~)[err 1]
15:16:37 3688 simon@nuit% createuser -E -U postgres -P -W foo
Enter password for new user:
Enter it again:
Shall the new user be allowed to create databases? (y/n) n
Shall the new user be allowed to create more new users? (y/n) n
Password:
CREATE USER

> I fixed createuser to build a valid SQL string even if only '-E' is
> given, it is just ignored then. Is that okay? I don't want to change

doesn't bother me :).

> the semantics of the program too much away from the official version,
> but I will send the patch to the original authors (Oliver: where to
> send this at?).
> 
> I will soon commit the patch to the cvs, the next release will fix
> that.
> 
> Thanks and have a nice day!
> 
> Martin
> 
> -- 
> Martin Pitt                 Debian GNU/Linux Developer
> martin@piware.de                      mpitt@debian.org
> http://www.piware.de             http://www.debian.org