Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYGHa-000396-B8 for pgsql-general@arkaria.postgresql.org; Wed, 27 Jun 2018 19:39:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fYGHY-00034O-4U for pgsql-general@arkaria.postgresql.org; Wed, 27 Jun 2018 19:39:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYGHX-00034H-EJ for pgsql-general@lists.postgresql.org; Wed, 27 Jun 2018 19:39:11 +0000 Received: from resqmta-ch2-03v.sys.comcast.net ([2001:558:fe21:29:69:252:207:35]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYGHT-0003eD-Jr for pgsql-general@postgresql.org; Wed, 27 Jun 2018 19:39:10 +0000 Received: from resomta-ch2-04v.sys.comcast.net ([69.252.207.100]) by resqmta-ch2-03v.sys.comcast.net with ESMTP id YDq9fMJky4SHDYGHOfSmRR; Wed, 27 Jun 2018 19:39:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1530128342; bh=f9sXgpkkrIwmz82UX6ETig4K41EiKiEIu1Birm85qgg=; h=Received:Received:Received:From:To:Subject:Date:Message-ID: MIME-Version:Content-Type; b=bRPX+gZyd9d4f07yv+TPr9V2n78iQdgXolkEzd25Ry1pcNBx6KpninIzVT0NuYV1S WyP9mcNSItgP7EyFZbJHDv3QF2rEzL+Q5h2ZM6rGitzMLqqLQdTtnNV60iDX0PoPeK m68oFEYcG2424/z2GuM0KLAWyhU21bqz1tX+dcEkOckRJcrxRN0RKnYPWrALlMpyTQ 4nkbN+QL/dNcyZLo5DO5ES8KoslZMeVbR8mVvIuY3khFcdVTqOpzq4H7gXtIMfYilI xvPCNyxmwlFfjNy3y1yUxL+TchYyGsxBGlxt55Iv+mw3+vjuAm4W5zdrQRaVMhpHuU KzFSKjqHTGs0Q== Received: from jsievers.comcast.net ([12.30.159.20]) by resomta-ch2-04v.sys.comcast.net with ESMTPA id YGHFf4AVSwxvzYGHGfcVeF; Wed, 27 Jun 2018 19:39:00 +0000 Received: from jsievers.enova.com (localhost [127.0.0.1]) by jsievers.comcast.net (Postfix) with ESMTP id A1BF5260056; Wed, 27 Jun 2018 14:38:53 -0500 (CDT) From: Jerry Sievers To: Susan Hurst Cc: pgsql-general@postgresql.org Subject: Re: Space Stalker in SQL Output References: <8ad8301badea6566622771129517cf02@mail.brookhurstdata.net> Date: Wed, 27 Jun 2018 14:38:53 -0500 In-Reply-To: <8ad8301badea6566622771129517cf02@mail.brookhurstdata.net> (Susan Hurst's message of "Wed, 27 Jun 2018 14:09:23 -0500") Message-ID: <87zhzgauk2.fsf@jsievers.enova.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-CMAE-Envelope: MS4wfMveLD7CxKoZlrf6jhUgOavpK0a3YkCqydl+CFsX8KM3u3ELBQggeKcsdNPhtcj4gViEBTNwHn2aqXZSHvqhwVKEuN1/lHcHLOFLCohBQh3EiWGUjfHA y56MrP+Qba9Q6iEatczDiPDzYc5m7wIlBsD85dCf7a1z4QXCScvFPCQDVtChfiB4RpcGP3TtFjPdKj4jl060RcFI/rSLCfdxCF/b+N/12VKBAuW11BmERHb0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Susan Hurst writes: > Why would a psql statement insert a leading space into the output, > which is a single integer value? > > The leading space caused my job call to fail elsewhere in the same > shell script as the psql call. Here is the anonymized version of the > psql call to assign a value to a shell script variable: > > IDz=`psql -d proddb -U produser -h 10.9.999.99 -p 99900 -t < > last_id.sql` Get in the habit of including -A which gets rid of alignment padding in psql output. As in... shellvar=`psql -Atqc 'select froboz;'` $db HTH -- Jerry Sievers Postgres DBA/Development Consulting e: postgres.consulting@comcast.net p: 312.241.7800