重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 635|回复: 0
打印 上一主题 下一主题

opengauss的gsql 以行的方式显示记录的选项 -x

[复制链接]
跳转到指定楼层
楼主
发表于 2022-11-17 17:14:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 郑全 于 2022-11-17 17:16 编辑

一般我们显示记录,都是以行的方式显示:

postgres=# select * from pg_settings where name='max_connections';
      name       | setting | unit |                       category                       |                           short_desc                           | extra_des
c |  context   | vartype |       source       | min_val | max_val | enumvals | boot_val | reset_val |            sourcefile             | sourceline
-----------------+---------+------+------------------------------------------------------+----------------------------------------------------------------+----------
--+------------+---------+--------------------+---------+---------+----------+----------+-----------+-----------------------------------+------------
max_connections | 800     |      | Connections and Authentication / Connection Settings | Sets the maximum number of concurrent connections for clients. |         
  | postmaster | integer | configuration file | 10      | 262143  |          | 200      | 800       | /gaussdb/data/db1/postgresql.conf |         65
(1 row)


这时字段太多,在一行上面显示,不方便显示。

能否象MYSQL那样,可以以行的方式显示每个字段,答案是肯定的,可以进入数据库之前,带上 -x ,注意,是小写的x。

[omm@dbserver1 db1]$ gsql -d postgres -p 26000 -r -x -q
postgres=# select * from pg_settings where name='max_connections';
-[ RECORD 1 ]--------------------------------------------------------------
name       | max_connections
setting    | 800
unit       |
category   | Connections and Authentication / Connection Settings
short_desc | Sets the maximum number of concurrent connections for clients.
extra_desc |
context    | postmaster
vartype    | integer
source     | configuration file
min_val    | 10
max_val    | 262143
enumvals   |
boot_val   | 200
reset_val  | 800
sourcefile | /gaussdb/data/db1/postgresql.conf
sourceline | 65


现在看到,再多的列,也不怕了。

当然,也可以进入数据库后,临时调整显示方式

postgres=# \x off
postgres=# select * from test1;
id | name
----+------
  1 | jbb
  3 | jdb3
(2 rows)



postgres=# \x on
postgres=#
postgres=# select * from test1;
-[ RECORD 1 ]
id   | 1
name | jbb
-[ RECORD 2 ]
id   | 3
name | jdb3





分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-4-19 11:42 , Processed in 0.120004 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表