Reputation: 273
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?
Upvotes: 4
Views: 3251
Reputation: 855
The -a option repeats every query on the terminal (STDOUT), you want to remove this option from your commandline.
Upvotes: 1
Reputation: 37099
-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
...
Upvotes: 6