Today I Learned

hashrocket A Hashrocket project

Export text exactly from psql

psql will automatically add headers to output and wrap long lines of text. To get the value without this noise switch to tuples only mode and unaligned format.

\t on
\pset format unaligned

This can be combined with a previous TIL by joshbranchaud to export the query output to a file.

select body from posts where id=123 \g post123.txt
See More #sql TILs
Looking for help? Hashrocket developers believe that data quality is as important as code quality. We enjoy all the challenges of relational databases, from finding the fastest index, to structuring data to fit the needs of an application. We're eager to share our experiences; check out PG Casts, our series of free PostgreSQL screencasts.