BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?

From: "Aleksey Tsalolikhin" <atsaloli(dot)tech(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?
Date: 2011-07-13 20:53:48
Message-ID: 201107132053.p6DKrmmV052152@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 6117
Logged by: Aleksey Tsalolikhin
Email address: atsaloli(dot)tech(at)gmail(dot)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2011-07-13 20:58:30 Re: [BUGS] extract(epoch from infinity) is not 0
Previous Message Robert Haas 2011-07-13 20:13:12 Re: [BUGS] extract(epoch from infinity) is not 0