psql:初始化文件? [英] psql: Init files?

查看:154
本文介绍了psql:初始化文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在psql文档中,我阅读了有关变量的信息(部分高级功能),例如这些变量之一是:

In the psql documentation, I read information about variables (section advanced features), e.g. one of these variables is:

HISTSIZE
The number of commands to store in the command history. The default value is 500.

主目录中或我可以配置的其他地方是否有文件这些变量?

Is there a file in the home directory or somewhere else where I can configure these variables?

我将在该文件中使用什么语法?

What syntax would I use in that file?

推荐答案

如果您会看到 文件部分,您会看到以下内容:

If you look at the Files section, you'll see this:


文件


  • 除非传递了 -X -c 选项,psql尝试从系统范围的 psqlrc 文件和用户的〜/ .psqlrc 文件读取和执行命令在开始之前。 (在Windows上,用户的启动文件名为%APPDATA%\postgresql\psqlrc.conf 。)请参见 PREFIX / share / psqlrc.sample。 有关设置系统范围文件的信息。它可以用来设置客户端或服务器的口味(使用 \set SET 命令)

  • Unless it is passed an -X or -c option, psql attempts to read and execute commands from the system-wide psqlrc file and the user's ~/.psqlrc file before starting up. (On Windows, the user's startup file is named %APPDATA%\postgresql\psqlrc.conf.) See PREFIX/share/psqlrc.sample for information on setting up the system-wide file. It could be used to set up the client or the server to taste (using the \set and SET commands).

用户〜/ .psqlrc 文件的位置也可以通过<$ c $显式设置。 c> PSQLRC 环境设置。

The location of the user's ~/.psqlrc file can also be set explicitly via the PSQLRC environment setting.

就像大多数Unix命令中,都有一个RC(运行命令)文件可用于配置,该名称还与〜/。 cmd rc 的Unix约定匹配。 code>,所以您要〜/ .psqlrc

So like most Unix commands, there is an RC ("Run Commands") file that you can use for configuration, the name also matches the Unix conventions of ~/.cmdrc so you want ~/.psqlrc.

格式与 psql 本身中使用的> \set 命令:

The format matches the \set commands you'd use within psql itself:

\set HISTSIZE 11

这篇关于psql:初始化文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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