Grimoire-
Command
.es

GNU+Linux command memo

Vertical output for SQL request

Obtenir un affichage vertical des requêtes SQL.

MySQL / MariaDB
> SELECT * FROM table_foo \G

***************
 id: 1
bar: Hello
***************
 id: 2
bar: World
PostgreSQL
# SELECT * FROM table_foo \x\g\x

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

The vertical mode can be toggled for a session :

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

Or use -x switch when running non-interactively :

$ psql db_name_foo -xc 'SELECT * from table_foo'
SQLite3

Not available.