Re: Multiple atributes with -P switch to psql - Mailing list pgsql-general

From Harvey, Allan AC
Subject Re: Multiple atributes with -P switch to psql
Date
Msg-id E97A5BB7699CAD48BE2711E71247116547A005@ntlmsg03.onesteel.com
Whole thread Raw
In response to Re: Multiple atributes with -P switch to psql  ("Stuart Cooper" <stuart.cooper@gmail.com>)
List 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
anexample 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@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,
pleaseadvise the sender and delete the document. Neither OneSteel nor the sender accept responsibility for any viruses
containedin this email or any attachments.
 

pgsql-general by date:

Previous
From: "Stuart Cooper"
Date:
Subject: Re: Multiple atributes with -P switch to psql
Next
From: "Uwe C. Schroeder"
Date:
Subject: Where is contrib?