开发者

PostgreSQL: .psql_history to /dev/null

Rather than apply a \set HISTFILE command for every possible connection, we would like to have no .psql_history at all. However, psql seems to dislike that:

% ln -s /dev/null ~/.psql_history
% psql
psql (8.4.8)
postgres=# select version();
...
postgres=# \q
could not save history to file "~/.psql_history": Not owner

There ar开发者_运维技巧e folks out there willing to patch the source to get a fix but we prefer to be on a vanilla binary installation whenever possible: to us, this isn't worth the hack.

To clarify: we don't want anything kept in this default filename, regardless of whether or not the user on this machine remembers (or knows) what options to pass.

Any suggestions?


You can use -n (or synonym --no-readline) switch in psql command:

Do not use readline for line editing and do not use the history. This can be useful to turn off tab expansion when cutting and pasting.

EDIT:

As another way you can create ~/.psqlrc file that contains \set HISTFILE /dev/null. With that psql doesn't create unwanted .psql_history file at all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜