PostgreSQL:.psql_history到/ dev / null [英] PostgreSQL: .psql_history to /dev/null

查看:357
本文介绍了PostgreSQL:.psql_history到/ dev / null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们希望没有 .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:


请勿使用readline进行行编辑,也不要使用历史记录。此
在剪切和粘贴时可以关闭选项卡扩展。

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.

编辑:

另一种方法是,您可以创建〜/ .psqlrc 文件,其中包含 \set HISTFILE / dev / null 。这样,ps​​ql根本不会创建不需要的 .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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆