On Sun, Apr 03, 2005 at 11:17:41PM +0200, Pavel Stehule wrote:
> test=# select * from foo;
>  a  | b
> ----+----
>  10 | 10
>  10 | 20
> 
> pgbash> retval=`select a,b from foo;`
> pgbash> echo $retval
> a | b ----+---- 10 | 10 10 | 20 (2 rows)

The way I usually do it in scripts is:

psql '-F<tab>' -A -t -c "query"

If there's only one field output you can drop the -F.

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment: pgpEcRcyNegB3.pgp
Description: PGP signature

Reply via email to