Re: How to query pgsql from a BASH script ? - Mailing list pgsql-general

From Pavel Stehule
Subject Re: How to query pgsql from a BASH script ?
Date
Msg-id Pine.LNX.4.44.0504032306340.12689-100000@kix.fsv.cvut.cz
Whole thread Raw
In response to Re: How to query pgsql from a BASH script ?  (Michelle Konzack <linux4michelle@freenet.de>)
Responses Re: How to query pgsql from a BASH script ?  (Martijn van Oosterhout <kleptog@svana.org>)
Re: How to query pgsql from a BASH script ?  (Michelle Konzack <linux4michelle@freenet.de>)
List pgsql-general
> So if I understand it right, if I have a table like
>
> Table:  ip_table
>        ip       |   ctime    |   atime
> ----------------+------------+------------
> aaa.bbb.ccc.ddd | 1234567890 | 2345678901
> eee.fff.ggg.hhh | 3456789012 | 4567890123
>
> and I need only
>
>     CONNECT TO localhost USER michelle.konzack;
>     RETVAL=`SELECT ctime, atime FROM ip_table WHERE ip = $SEARCH;`
>
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)

I remeber other project

http://www.edlsystems.com/shellsql

bye

Pavel Stehule



pgsql-general by date:

Previous
From: Daniel Schuchardt
Date:
Subject: Re: Inheritance and such
Next
From: Keary Suska
Date:
Subject: Re: Empty date