重庆思庄Oracle、Redhat认证学习论坛
标题:
opengauss的gsql 以行的方式显示记录的选项 -x
[打印本页]
作者:
郑全
时间:
2022-11-17 17:14
标题:
opengauss的gsql 以行的方式显示记录的选项 -x
本帖最后由 郑全 于 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
欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/)
Powered by Discuz! X3.2