PostgreSQL psql terminal command
These are not command line args. Run psql. Manage to log into database (so pass the hostname, port, user and database if needed). And then write it in the psql program.
Example (below are two commands, write the first one, press enter, wait for psql to login, write the second):
psql -h host -p 5900 -U username database\pset format aligned
Use \x
Example from postgres manual:
postgres=# \x postgres=# SELECT * FROM pg_stat_statements ORDER BY total_time DESC LIMIT 3; -[ RECORD 1 ]------------------------------------------------------------ userid | 10 dbid | 63781 query | UPDATE branches SET bbalance = bbalance + $1 WHERE bid = $2; calls | 3000 total_time | 20.716706 rows | 3000 -[ RECORD 2 ]------------------------------------------------------------ userid | 10 dbid | 63781 query | UPDATE tellers SET tbalance = tbalance + $1 WHERE tid = $2; calls | 3000 total_time | 17.1107649999999 rows | 3000 -[ RECORD 3 ]------------------------------------------------------------ userid | 10 dbid | 63781 query | UPDATE accounts SET abalance = abalance + $1 WHERE aid = $2; calls | 3000 total_time | 0.645601 rows | 3000
psql --pset=format=FORMAT
Great for executing queries from command line, e.g.
psql --pset=format=unaligned -c "select bandanavalue from bandana where bandanakey = 'atlassian.confluence.settings';"