Worked perfectly, I forgot you could add multiple usernames to the UI ![]()
For others, to export the psql query result simply run:
psql
\o /home/discourse/output.txt
<your query here>
\o
exit
Now in /home/discourse/output.txt you will have the result of the query as it would be printed on screen.