问题描述
我们希望没有 .psql_history \set HISTFILE
命令>。但是,psql似乎不喜欢这样:
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 are 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.
有什么建议吗?
推荐答案
您可以在-n (或同义词-no-readline
)开关http://www.postgresql.org/docs/8.4/static/app-psql.html rel = nofollow> psql
命令:
You can use -n
(or synonym --no-readline
) switch in psql
command:
编辑:
另一种方法是,您可以创建〜/ .psqlrc
文件,其中包含 \set HISTFILE / dev / null
。这样,psql根本不会创建不需要的 .psql_history
文件。
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.
这篇关于PostgreSQL:.psql_history到/ dev / null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!