From 9bf6effd8e78ed4cfed8f14d36d055e66943461e Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Fri, 8 Oct 2004 11:24:19 +0000 Subject: [PATCH] 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. --- src/bin/psql/startup.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index 01aba011b2..3af3bc789d 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2004, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.102 2004/10/06 08:20:58 neilc Exp $ + * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.103 2004/10/08 11:24:19 neilc Exp $ */ #include "postgres_fe.h" @@ -140,9 +140,13 @@ main(int argc, char *argv[]) SetVariable(pset.vars, "VERSION", PG_VERSION_STR); - /* Default values for variables that are used in noninteractive cases */ + /* Default values for variables */ SetVariableBool(pset.vars, "AUTOCOMMIT"); SetVariable(pset.vars, "VERBOSITY", "default"); + SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1); + SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2); + SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3); + pset.verbosity = PQERRORS_DEFAULT; pset.notty = (!isatty(fileno(stdin)) || !isatty(fileno(stdout))); @@ -300,11 +304,6 @@ main(int argc, char *argv[]) #endif } - /* Default values for variables that are used in interactive case */ - SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1); - SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2); - SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3); - if (!pset.notty) initializeInput(options.no_readline ? 0 : 1); if (options.action_string) /* -f - was used */