I think you might be looking for the expanded output \x
.
regress=> \x
Expanded display is on.
regress=> select * from posts;
-[ RECORD 1 ]---------
id | 1
title | bork bork bork
-[ RECORD 2 ]---------
id | 2
title | honkey tonk
or maybe \x\t\a
(extended, tuples-only, unaligned):
craig=> \x\t\a
Expanded display is on.
Tuples only is on.
Output format is unaligned.
craig=> select * from posts;
id|1
title|bork bork bork
id|2
title|honkey tonk
You may want \f :
too:
craig=> \x\t\a\f :
Expanded display is on.
Tuples only is on.
Output format is unaligned.
Field separator is ":".
craig=> select * from posts;
id:1
title:bork bork bork
id:2
title:honkey tonk
When I'm invoking psql
from a script, I tend to use:
psql -qAt
often with the -0
option, too, so it emits null bytes as record separators so fields with embedded newlines are more easily handled.