磐维数据库中如何实现查询结果按列展示?类似与MySQL数据库的\G效果,可以使用\x命令,以扩展方式显示查询结果。示例如下:
postgres=# \x
Expanded display is on.
postgres=# select * from pg_user;
-[ RECORD 1 ]----+-------------
usename | dtp
usesysid | 20720
usecreatedb | 0
usesuper | 0
usecatupd | 0
userepl | 0
passwd | ********
valbegin |
valuntil |
respool | default_pool
parent | 0
spacelimit |
useconfig |
nodegroup |
tempspacelimit |
spillspacelimit |
usemonitoradmin | 0
useoperatoradmin | 0
usepolicyadmin | 0
-[ RECORD 2 ]----+-------------
usename | sdr_repl
usesysid | 20713
usecreatedb | 0
usesuper | 0
usecatupd | 0
userepl | 1
passwd | ********
valbegin |
valuntil |
respool | default_pool
parent | 0
spacelimit |
useconfig |
nodegroup |
tempspacelimit |
spillspacelimit |
usemonitoradmin | 0
useoperatoradmin | 0
usepolicyadmin | 0
再执行\x命令恢复默认显示方法。
postgres=# \x
Expanded display is off.