summaryrefslogtreecommitdiff
path: root/src/bin/scripts/createuser.c
diff options
context:
space:
mode:
authorTom Lane2004-01-09 00:15:19 +0000
committerTom Lane2004-01-09 00:15:19 +0000
commitb8a46aefe4747532bc96b2cd81fa49a05eee39eb (patch)
treeed86274fc48169d749ac2f32ba5bfffe53258c26 /src/bin/scripts/createuser.c
parent7b69da5958d48ac5876fe05fbb057f009327460d (diff)
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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c
index 8007bfca2d..fd627b7f1a 100644
--- a/src/bin/scripts/createuser.c
+++ b/src/bin/scripts/createuser.c
@@ -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);
}