summaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-09-13 22:18:22 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-09-13 22:18:22 +0000
commite97281c46cb14ecb91c473b6bd2b0435a50c0875 (patch)
tree82490966eb37a17515419cd61a42e7a58c34e201 /src/bin/psql/command.c
parenteb62398f391eedee7953becb410bf3ae86b9872b (diff)
Write psql's ~/.psql_history file using history_truncate_file() and
append_history(), if libreadline is new enough to have those functions (they seem to be present at least since 4.2; but libedit may not have them). This gives significantly saner behavior when two or more sessions overlap in their use of the history file; although having two sessions exit at just the same time is still perilous to your history. The behavior of \s remains unchanged, ie, overwrite whatever was there. Per bug #5052 from Marek Wójtowicz.
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 7c815b8f977..67f05a89de0 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.206 2009/06/11 14:49:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.207 2009/09/13 22:18:22 tgl Exp $
*/
#include "postgres_fe.h"
#include "command.h"
@@ -908,7 +908,7 @@ exec_command(const char *cmd,
expand_tilde(&fname);
/* This scrolls off the screen when using /dev/tty */
- success = saveHistory(fname ? fname : DEVTTY, false);
+ success = saveHistory(fname ? fname : DEVTTY, -1, false, false);
if (success && !pset.quiet && fname)
printf(gettext("Wrote history to file \"%s/%s\".\n"),
pset.dirname ? pset.dirname : ".", fname);