pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aleksey Tsalolikhin <atsaloli.tech@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?
Date: Wed, 13 Jul 2011 20:53:48 GMT
Message-ID: <201107132053.p6DKrmmV052152@wwwmaster.postgresql.org> (raw)


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



view thread (5+ messages)  latest in thread

Message-ID: <201107132053.p6DKrmmV052152@wwwmaster.postgresql.org>
Permalink:  ../201107132053.p6DKrmmV052152@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201107132053.p6DKrmmV052152@wwwmaster.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: atsaloli.tech@gmail.com
  Subject: Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?
  In-Reply-To: <201107132053.p6DKrmmV052152@wwwmaster.postgresql.org>
  References: <201107132053.p6DKrmmV052152@wwwmaster.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox