Re: Space Stalker in SQL Output

From: Jerry Sievers <gsievers19(at)comcast(dot)net>
To: Susan Hurst <susan(dot)hurst(at)brookhurstdata(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Space Stalker in SQL Output
Date: 2018-06-27 19:38:53
Message-ID: 87zhzgauk2.fsf@jsievers.enova.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Susan Hurst <susan(dot)hurst(at)brookhurstdata(dot)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(dot)consulting(at)comcast(dot)net
p: 312.241.7800

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Susan Hurst 2018-06-27 19:45:55 Re: Space Stalker in SQL Output
Previous Message Susan Hurst 2018-06-27 19:09:23 Space Stalker in SQL Output