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

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Aleksey Tsalolikhin <atsaloli(dot)tech(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?
Date: 2011-07-14 02:10:28
Message-ID: 4E1E5014.2080101@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 14/07/2011 4:53 AM, Aleksey Tsalolikhin wrote:
> 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.
>
What's happening is that all of them are processed, but only the output
for the last one is emitted. I agree that the documentation isn't clear
about that, and I'm not sure whether or not that was the intended result.

psql -c "CREATE TABLE test(x integer); INSERT INTO test(x) VALUES
(1),(2),(3); SELECT version(); SELECT * FROM test;"
x
---
1
2
3
(3 rows)

Comments anybody? Just fix the docs, or is this a behaviour issue?

--
Craig Ringer

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088 Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Shahnawaz Shaikh 2011-07-14 05:38:39 BUG #6118: Server doesn't listen
Previous Message Brendan Jurd 2011-07-13 22:44:03 Re: [BUGS] extract(epoch from infinity) is not 0