From: Jerry Sievers <gsievers19@comcast.net>
To: Susan Hurst <susan.hurst@brookhurstdata.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Space Stalker in SQL Output
Date: Wed, 27 Jun 2018 14:38:53 -0500
Message-ID: <87zhzgauk2.fsf@jsievers.enova.com> (raw)
In-Reply-To: <8ad8301badea6566622771129517cf02@mail.brookhurstdata.net>
References: <8ad8301badea6566622771129517cf02@mail.brookhurstdata.net>
Susan Hurst <susan.hurst@brookhurstdata.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: gsievers19@comcast.net, susan.hurst@brookhurstdata.com
Subject: Re: Space Stalker in SQL Output
In-Reply-To: <87zhzgauk2.fsf@jsievers.enova.com>
References: <8ad8301badea6566622771129517cf02@mail.brookhurstdata.net> <87zhzgauk2.fsf@jsievers.enova.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox