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

Поиск
Список
Период
Сортировка
От Aleksey Tsalolikhin
Тема BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?
Дата
Msg-id 201107132053.p6DKrmmV052152@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?  (Craig Ringer <craig@postnewspapers.com.au>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      6117
Logged by:          Aleksey Tsalolikhin
Email address:      atsaloli.tech@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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "tushar"
Дата:
Сообщение: BUG #6116: Not able to drop user if S/he has permission on tablespace
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?