mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
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.
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user