Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 570E1B5DBE6 for ; Wed, 13 Jul 2011 23:10:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 19298-06 for ; Thu, 14 Jul 2011 02:10:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [173.230.139.50]) by mail.postgresql.org (Postfix) with ESMTP id 2CC42B5DBE1 for ; Wed, 13 Jul 2011 23:10:38 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by www.postnewspapers.com.au (Postfix) with ESMTP id 5DF91823; Wed, 13 Jul 2011 22:10:38 -0400 (EDT) X-Virus-Scanned: amavisd-new at postnewspapers.com.au.com Received: from www.postnewspapers.com.au ([127.0.0.1]) by localhost (www.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id MYnSxk2BRIFg; Wed, 13 Jul 2011 22:10:37 -0400 (EDT) Received: from mail.postnewspapers.com.au (ppp171-128.static.internode.on.net [150.101.171.128]) by www.postnewspapers.com.au (Postfix) with ESMTP id 68CC427; Wed, 13 Jul 2011 22:10:37 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 5271AAF062; Thu, 14 Jul 2011 10:10:36 +0800 (WST) X-Amavis-Modified: Mail body modified (using disclaimer) - mail.postnewspapers.com.au X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cRTUR3QfSKo6; Thu, 14 Jul 2011 10:10:31 +0800 (WST) Received: from [10.1.1.8] (58-7-210-8.dyn.iinet.net.au [58.7.210.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id DF2C6AF406; Thu, 14 Jul 2011 10:10:30 +0800 (WST) Message-ID: <4E1E5014.2080101@postnewspapers.com.au> Date: Thu, 14 Jul 2011 10:10:28 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Aleksey Tsalolikhin CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug? References: <201107132053.p6DKrmmV052152@wwwmaster.postgresql.org> In-Reply-To: <201107132053.p6DKrmmV052152@wwwmaster.postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201107/113 X-Sequence-Number: 30725 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.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. > 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/