Display select results vertically in psql, as is done by MySQL's \G

后端 未结 1 1674
逝去的感伤
逝去的感伤 2020-12-12 18:54

In MySQL, you can terminate a select query with \\G (as opposed to \\g) to display the results vertically:

select * fr         


        
相关标签:
1条回答
  • 2020-12-12 19:13

    You can do this by enabling Expanded display.

    Toggle this setting via \x. For example:

    # \x
    Expanded display is on.
    # \x
    Expanded display is off.
    

    When on, results are shown in tabular (vertical) form:

    -[ RECORD 1 ]
    id  | 1
    bar | Hello
    -[ RECORD 2 ]
    id  | 2
    bar | World
    

    You can run this for a single command by using the \x\g\x suffix to toggle expanded display on, run the query, then toggle it off again.

    select * from foo \x\g\x
    
    0 讨论(0)
提交回复
热议问题