Save PL/pgSQL output from PostgreSQL to a CSV file Save PL/pgSQL output from PostgreSQL to a CSV file sql sql