Skip to content

Commit ccdeed7

Browse files
committed
Fix incorrect SQL syntax emitted when -E is given without -P.
Report and fix from Martin Pitt.
1 parent 5390e28 commit ccdeed7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/bin/scripts/createuser.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
8-
* $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.8 2004/01/01 19:27:15 tgl Exp $
8+
* $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.9 2004/01/09 00:15:11 tgl Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -189,12 +189,12 @@ main(int argc, char *argv[])
189189
printfPQExpBuffer(&sql, "CREATE USER %s", fmtId(newuser));
190190
if (sysid)
191191
appendPQExpBuffer(&sql, " SYSID %s", sysid);
192-
if (encrypted == +1)
193-
appendPQExpBuffer(&sql, " ENCRYPTED");
194-
if (encrypted == -1)
195-
appendPQExpBuffer(&sql, " UNENCRYPTED");
196192
if (newpassword)
197193
{
194+
if (encrypted == +1)
195+
appendPQExpBuffer(&sql, " ENCRYPTED");
196+
if (encrypted == -1)
197+
appendPQExpBuffer(&sql, " UNENCRYPTED");
198198
appendPQExpBuffer(&sql, " PASSWORD ");
199199
appendStringLiteral(&sql, newpassword, false);
200200
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy