+
+ PSQL_HISTORY
+
+
+ Alternative location for the command history file. Tilde ("~") expansion is performed.
+
+
+
+
+
+ PSQLRC
+
+
+ Alternative location of the user's .psqlrc file. Tilde ("~") expansion is performed.
+
+
+
+
SHELL
to set up the client or the server to taste (using the \set
and SET commands).
+ The location of the user's ~/.psqlrc file can
+ also be set explicitly via the PSQLRC environment
+ setting.
+
~/.psql_history, or
%APPDATA%\postgresql\psql_history on Windows.
+ The location of the history file can
+ also be set explicitly via the PSQL_HISTORY environment
+ setting.
+
history_lines_added = 0;
histfile = GetVariable(pset.vars, "HISTFILE");
+
+ if (histfile == NULL)
+ {
+ char * envhist;
+ envhist = getenv("PSQL_HISTORY");
+ if (envhist != NULL && strlen(envhist) > 0)
+ histfile = envhist;
+ }
+
if (histfile == NULL)
{
if (get_home_path(home))
char rc_file[MAXPGPATH];
char my_exec_path[MAXPGPATH];
char etc_path[MAXPGPATH];
+ char *envrc;
find_my_exec(argv0, my_exec_path);
get_etc_path(my_exec_path, etc_path);
snprintf(rc_file, MAXPGPATH, "%s/%s", etc_path, SYSPSQLRC);
process_psqlrc_file(rc_file);
- if (get_home_path(home))
+ envrc = getenv("PSQLRC");
+
+ if (envrc != NULL && strlen(envrc) > 0)
+ {
+ expand_tilde(&envrc);
+ process_psqlrc_file(envrc);
+ }
+ else if (get_home_path(home))
{
snprintf(rc_file, MAXPGPATH, "%s/%s", home, PSQLRC);
process_psqlrc_file(rc_file);