如何在psql中设置默认显示模式 [英] How to set default display mode in psql

查看:111
本文介绍了如何在psql中设置默认显示模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果没有 显示配置命令\x auto.为每个 psql 实例手动输入这个很烦人.

Almost every psql query comes out an illegible mess if not preceded by display configuration commands such as \x auto. Typing this manually for each psql instance is annoying.

自动使用扩展显示.

有没有办法配置更好的默认显示?或者也许答案是使用更高级的交互式终端?

Is there any way to configure a better default display? Or perhaps the answer is to use a more advanced interactive terminal?

推荐答案

使用 .psqlrc 设置默认值.

Use .psqlrc to set defaults.

对于 \x 的特定情况,较新的 psql 版本(我认为是 9.3,但它可能只是 9.4 预发布版)可以自动切换到扩展当行太宽而无法容纳在一行中时的输出模式.来自 \?:

For the specific case of \x, newer psql versions (9.3, I think, but it might just be the 9.4 pre-release) can automatically switch to expanded output mode when the rows are too wide to fit on a line. From \?:

\x [on|off|auto] 切换扩展输出(当前关闭)

\x [on|off|auto] toggle expanded output (currently off)

所以我建议将 \x auto 放在你的 .psqlrc 中,而不是强制它on.

So I suggest putting \x auto in your .psqlrc, rather than forcing it to on.

这篇关于如何在psql中设置默认显示模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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