The following bug has been logged online: Bug reference: 6117 Logged by: Aleksey Tsalolikhin Email address: atsaloli.t...@gmail.com PostgreSQL version: 8.4.8 Operating system: CentOS 5.5 (64-bit) Description: psql -c does not work as expected. a documentation bug? a program bug? Details:
The psql man page says, in the section for the -c option: If the command string contains multiple SQL commands, they are processed in a single transaction However when I run a command string with multiple SQL commands, apparently only the last one is processed. For example: # psql -U postgres -c "select now(); select now(); select version();" version ---------------------------------------------------------------------------- -------------------------------------- PostgreSQL 8.4.8 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48), 64-bit (1 row) # Yet this works fine: # echo "select now(); select now(); select version();"|psql -f- -U postgres now ------------------------------- 2011-07-13 13:51:01.594725-07 (1 row) now ------------------------------- 2011-07-13 13:51:01.597903-07 (1 row) version ---------------------------------------------------------------------------- -------------------------------------- PostgreSQL 8.4.8 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48), 64-bit (1 row) # This is what I expect to see. Could you please fix psql or make the documentation for the -c option more clear? Thanks very much and thanks for a great product! Yours truly, Aleksey -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs