我从一个有长文本列的表中进行选择。我想把长队包到最大线长。
发自:
SELECT * FROM test;
test_id | text
--------+-----------------------------------------------------------------------
1 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris lorem至:
test_id | text
--------+-----------------------------
1 | Lorem ipsum dolor sit amet,+
| consectetur adipiscing elit+
| . Mauris lorem发布于 2014-07-02 15:16:24
如果您使用的是psql命令行工具,请首先发出以下命令:
\pset format wrapped然后,它应该将长队包裹到终端窗口,如下所示:
test_id | text
--------+-----------------------------
1 | Lorem ipsum dolor sit amet,.
|.consectetur adipiscing elit.
|.. Mauris lorem还可以将要包装的列数设置为
\pset columns 100您可以将圆点更改为椭圆
\pset linestyle unicode更多信息:http://www.postgresql.org/docs/current/static/app-psql.html
发布于 2011-03-14 14:07:52
我的答案不会直接回答你的问题,因为我不认为psql本身能够具体做到这一点。但是,\x将打开扩展的输出,这将使您的值如下所示:
-[ RECORD 1 ]------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
id | 1
longstring | This is a long string of text that will be quite long and most likely be very annoying to read if you are viewing results with more than at most a few columns of data. Words words words words words words lorem ipsum.您还可以将寻呼机配置为不换行。
要切换到正常显示,只需再次发出命令\x即可。解释:
\x [on|off|auto] toggle expanded output (currently off)https://dba.stackexchange.com/questions/1728
复制相似问题