On 10/18/2013 02:19 AM, Fabien COELHO wrote:

IMHO the current behavior is broken:

decibel@decina:[17:46]~/pgsql/HEAD/i$bin/psql -c 'select 1' -c 'select 2'
?column?
----------
       2
(1 row)

Another try with one -c but with similar results:

  sh> psql -c "SELECT 1; SELECT 'hello';"
    ?column?
    ----------
    hello
    (1 row)

  sh> psql -V
    psql (PostgreSQL) 9.3.1



It's not broken. All this behaviour is documented fairly explicitly. See <http://www.postgresql.org/docs/current/static/app-psql.html> For example, regarding Fabio's example, which is actually very different from Jim's, the docs say: "only the result of the last SQL command is returned."

If you want to argue that it should be enhanced, then do. But it's acting as designed and as documented.

I suspect changing this might actually have more wrinkles that you imagine, but I could be wrong.

Incidentally, both of you could probably achieve what you apparently want with:

   echo 'some sql here' | psql


cheers

andrew




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to