Re: Multiple atributes with -P switch to psql

From: "Harvey, Allan AC" <HarveyA(at)OneSteel(dot)com>
To: "Stuart Cooper" <stuart(dot)cooper(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Multiple atributes with -P switch to psql
Date: 2007-03-14 04:59:58
Message-ID: E97A5BB7699CAD48BE2711E71247116547A005@ntlmsg03.onesteel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stuart,

Thanks for the reply.

You are dead right, and as expected the problem is not with psql.

> $ psql -H -P tableattr='width="80%" bgcolor="#FFFFFF"'
>
> works for me. Carefully study my nice simple quoting: single quotes ''
> around the whole
> tableattr='THING' shebang and non-escaped double quotes "" for width
> and bgcolor values.
>
> Cheers,
> Stuart.
>

In my defence I did try that exact quoting, the problem is that it is being run from a script. I have thrown together an example to show the problem.
I have not yet worked to a solution.

If you know what it is I would be very greatful.

Allan

#!/bin/bash
set -x

DATABASEHOST="-h jitsnwm"
DATABASEUSER=galvuser
DATABASE=galvdb

TABLEOPTIONS="-P border=5 -P tableattr='width=\"80%\" bgcolor=\"#AFAFAF\"'"

ED=/usr/local/pgsql/bin

$ED/psql $DATABASEHOST -U $DATABASEUSER -d $DATABASE -q -P footer -P title=Summar
y -H $TABLEOPTIONS <<EOF_SQL

select version();

EOF_SQL

Produces....

postgres(at)jitsnwm:~/agl/sql> ./z.sh
+ DATABASEHOST=-h jitsnwm
+ DATABASEUSER=galvuser
+ DATABASE=galvdb
+ TABLEOPTIONS=-P border=5 -P tableattr='width="80%" bgcolor="#AFAFAF"'
+ ED=/usr/local/pgsql/bin
+ /usr/local/pgsql/bin/psql -h jitsnwm -U galvuser -d galvdb -q -P footer -P title=Summary -H -P border=5 -P 'tableattr='\''width="80%"' 'bgcolor="#AFAFAF"'\'''
<table border="5" 'width="80%">
<caption>Summary</caption>
<tr>
<th align="center">version</th>
</tr>
<tr valign="top">
<td align="left">PostgreSQL 8.2.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.3 (SuSE Linux)</td>
</tr>
</table>

The material contained in this email may be confidential, privileged or copyrighted. If you are not the intended recipient, use, disclosure or copying of this information is prohibited. If you have received this document in error, please advise the sender and delete the document. Neither OneSteel nor the sender accept responsibility for any viruses contained in this email or any attachments.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Uwe C. Schroeder 2007-03-14 05:17:50 Where is contrib?
Previous Message Stuart Cooper 2007-03-14 04:19:24 Re: Multiple atributes with -P switch to psql