Set all null fields to NULL:
After this,the query results look like this:
select 'test' as test_text,null as test_null; test_text | test_null -----------+----------- test| NULL (1 row)
Set the command history file names for each host and database:
\set HISTFILE ~/.psql_history- :HOST - :DBNAME