PostgreSQL:.psql_history 到 /dev/null
我们不想为每个可能的连接应用 \set HISTFILE
命令,而是根本不希望有 .psql_history
。然而,psql 似乎不喜欢这样:
% 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
有人愿意修补源代码以获得修复,但我们更喜欢尽可能使用普通二进制安装:对我们来说,这不值得破解。
澄清一下:我们不希望在此默认文件名中保留任何内容,无论这台计算机上的用户是否记得(或知道)要传递哪些选项。
有什么建议吗?
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.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
psql
命令:编辑:
作为另一种方式,您可以创建包含
\set HISTFILE /dev/null
的~/.psqlrc
文件。这样 psql 根本不会创建不需要的 .psql_history 文件。You can use
-n
(or synonym--no-readline
) switch inpsql
command: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.