Psql Tip #017
Using twice a
-c
or --command
flag
will display the result of both commands whereas feeding a
string with two queries to a -c
or
--command
flag will only display the result of
the last one.
laetitia:~$ psql -c 'select count(*) from test; select * from test;'
id | value
----+-------
1 | test
(1 row)
laetitia:~$ psql -c 'select count(*) from test;' -c ' select * from test;'
count
-------
1
(1 row)
id | value
----+-------
1 | test
(1 row)
This feature is available since at least Postgres 7.1.
See Postgres
documentation for more information.
Try a new tipSee them all