aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/createuser.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-01-09 00:15:11 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-01-09 00:15:11 +0000
commitccdeed7011843d99885ec32c991be9a7c1bd907d (patch)
treea44bcd630f2cbb7c654a5e77ea471abdd3e29308 /src/bin/scripts/createuser.c
parent5390e284dbf12bf4196576466dae1f5c170d0327 (diff)
downloadpostgresql-ccdeed7011843d99885ec32c991be9a7c1bd907d.tar.gz
postgresql-ccdeed7011843d99885ec32c991be9a7c1bd907d.zip
Fix incorrect SQL syntax emitted when -E is given without -P.
Report and fix from Martin Pitt.
Diffstat (limited to 'src/bin/scripts/createuser.c')
-rw-r--r--src/bin/scripts/createuser.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c
index 021decf4bdb..12c1aabb5d7 100644
--- a/src/bin/scripts/createuser.c
+++ b/src/bin/scripts/createuser.c
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* 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[])
printfPQExpBuffer(&sql, "CREATE USER %s", fmtId(newuser));
if (sysid)
appendPQExpBuffer(&sql, " SYSID %s", sysid);
- if (encrypted == +1)
- appendPQExpBuffer(&sql, " ENCRYPTED");
- if (encrypted == -1)
- appendPQExpBuffer(&sql, " UNENCRYPTED");
if (newpassword)
{
+ if (encrypted == +1)
+ appendPQExpBuffer(&sql, " ENCRYPTED");
+ if (encrypted == -1)
+ appendPQExpBuffer(&sql, " UNENCRYPTED");
appendPQExpBuffer(&sql, " PASSWORD ");
appendStringLiteral(&sql, newpassword, false);
}