Commit ccdeed70 authored by Tom Lane's avatar Tom Lane

Fix incorrect SQL syntax emitted when -E is given without -P.

Report and fix from Martin Pitt.
parent 5390e284
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.8 2004/01/01 19:27:15 tgl Exp $ * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.9 2004/01/09 00:15:11 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -189,12 +189,12 @@ main(int argc, char *argv[]) ...@@ -189,12 +189,12 @@ main(int argc, char *argv[])
printfPQExpBuffer(&sql, "CREATE USER %s", fmtId(newuser)); printfPQExpBuffer(&sql, "CREATE USER %s", fmtId(newuser));
if (sysid) if (sysid)
appendPQExpBuffer(&sql, " SYSID %s", sysid); appendPQExpBuffer(&sql, " SYSID %s", sysid);
if (encrypted == +1)
appendPQExpBuffer(&sql, " ENCRYPTED");
if (encrypted == -1)
appendPQExpBuffer(&sql, " UNENCRYPTED");
if (newpassword) if (newpassword)
{ {
if (encrypted == +1)
appendPQExpBuffer(&sql, " ENCRYPTED");
if (encrypted == -1)
appendPQExpBuffer(&sql, " UNENCRYPTED");
appendPQExpBuffer(&sql, " PASSWORD "); appendPQExpBuffer(&sql, " PASSWORD ");
appendStringLiteral(&sql, newpassword, false); appendStringLiteral(&sql, newpassword, false);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment