Skip to content

Commit 9bf6eff

Browse files
author
Neil Conway
committed
Another minor tweak to psql startup: set the default values for the PROMPT1,
PROMPT2 and PROMPT3 variables before we read any of the settings specified via the user on the command-line or in psqlrc, so that the latter can override the former. Per original patch from Ingo van Lil, simpler fix suggested by Tom Lane.
1 parent 79a831e commit 9bf6eff

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/bin/psql/startup.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.102 2004/10/06 08:20:58 neilc Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.103 2004/10/08 11:24:19 neilc Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -140,9 +140,13 @@ main(int argc, char *argv[])
140140

141141
SetVariable(pset.vars, "VERSION", PG_VERSION_STR);
142142

143-
/* Default values for variables that are used in noninteractive cases */
143+
/* Default values for variables */
144144
SetVariableBool(pset.vars, "AUTOCOMMIT");
145145
SetVariable(pset.vars, "VERBOSITY", "default");
146+
SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1);
147+
SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2);
148+
SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3);
149+
146150
pset.verbosity = PQERRORS_DEFAULT;
147151

148152
pset.notty = (!isatty(fileno(stdin)) || !isatty(fileno(stdout)));
@@ -300,11 +304,6 @@ main(int argc, char *argv[])
300304
#endif
301305
}
302306

303-
/* Default values for variables that are used in interactive case */
304-
SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1);
305-
SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2);
306-
SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3);
307-
308307
if (!pset.notty)
309308
initializeInput(options.no_readline ? 0 : 1);
310309
if (options.action_string) /* -f - was used */

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