Re: How to query pgsql from a BASH script ?

From: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
To: Michelle Konzack <linux4michelle(at)freenet(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to query pgsql from a BASH script ?
Date: 2005-04-03 21:17:41
Message-ID: Pine.LNX.4.44.0504032306340.12689-100000@kix.fsv.cvut.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Keary Suska 2005-04-03 22:50:01 Re: Empty date
Previous Message Karl O. Pinc 2005-04-03 21:05:37 Strange plpgsql performance -- arithmetic, numeric() type, arrays