From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | Jim Nasby <jim(at)nasby(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Multiple psql -c / -f options |
Date: | 2013-10-18 13:39:40 |
Message-ID: | 52613A1C.8070809@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 10/18/2013 02:19 AM, Fabien COELHO wrote:
>
>> IMHO the current behavior is broken:
>>
>> decibel(at)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Kane | 2013-10-18 13:39:45 | Re: removing old ports and architectures |
Previous Message | Stéphan BEUZE | 2013-10-18 13:36:33 | Re: ERROR : 'tuple concurrently updated' |