psql的备用输出格式

在PostgreSQL 9.2中,\x auto是新的扩展自动模式,它会自动调整记录以适应屏幕宽度。当记录不能适应屏幕宽度时,psql会切换到扩展模式。要启动psql使用\x auto,可以在~/.psqlrc中配置命令。此外,还可以使用\pset format wrapped尝试整齐地显示数据,或者使用环境变量PAGER配合自定义查看器以其他格式显示查询结果。
摘要由CSDN通过智能技术生成

本文翻译自:Alternate output format for psql

I am using PostgreSQL 8.4 on Ubuntu. 我在Ubuntu上使用PostgreSQL 8.4。 I have a table with columns c1 through cN . 我有一个表,其中的列c1cN The columns are wide enough that selecting all columns causes a row of query results to wrap multiple times. 列足够宽,选择所有列都会导致一行查询结果多次包装。 Consequently, the output is hard to read. 因此,输出难以读取。

When the query results constitute just a few rows, it would be convenient if I could view the query results such that each column of each row is on a separate line, eg 当查询结果仅占几行时,如果我可以查看查询结果以使每一行的每一列都位于单独的行(例如,

 c1: <value of row 1's c1>
 c2: <value of row 1's c1>
 ...
 cN: <value of row 1's cN>
 ---- some kind of delimiter ----
 c1: <value of row 2's c1>
 etc.

I am running these queries on a server where I would prefer not to install any additional software. 我在不希望安装任何其他软件的服务器上运行这些查询。 Is there a psql setting that will let me do something like that? 是否有一个psql设置可以让我做类似的事情?


#1楼

参考:https://stackoom.com/question/EiCT/psql的备用输出格式


#2楼

Also be sure to check out \\H, which toggles HTML output on/off. 另外,请务必检查出\\ H,它会打开/关闭HTML输出。 Not necessarily easy to read at the console, but interesting for dumping into a file (see \\o) or pasting into an editor/browser window for viewing, espe

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值