I use a file where I have all my SQL queries. I run the following command:
psql -U postgres -d rails_development -a -f ProjectApp/db/Query.sql
Output is as following:
SELECT * FROM "Users"
id | username | firstname | lastname | [...]
...
(27 rows)
I would like to remove query message (SELECT * FROM "Users") from output. Is that possible?
-a
or --echo-all
echoes all input from script. You won't need that. Include --tuples-only
or the -t
flag to print rows only like so:
psql -U postgres -d rails_development --tuples-only -f ProjectApp/db/Query.sql
psql --help
says:
...
Input and output options:
-a, --echo-all echo all input from script
-e, --echo-queries echo commands sent to server
...
Output format options:
...
-R, --record-separator=STRING
set record separator (default: newline)
-t, --tuples-only print rows only
...