Re: postgres on the comman line - Mailing list pgsql-sql

From A. Kretschmer
Subject Re: postgres on the comman line
Date
Msg-id 20050922141506.GE12957@webserv.wug-glas.de
Whole thread Raw
In response to postgres on the comman line  ("Michael Höller" <MichaelHoeller@t-online.de>)
List pgsql-sql
am  22.09.2005, um 15:55:53 +0200 mailte "Michael Höller" folgendes:
> 
> 
> Hello,
> 
> I like to automate a daily check and like to run select statement via
> cron but this seems to be more tricky than I thought....
> 
> I tried the following:
> su postgres -c "select count(*) from TABLE where xxxxxx;"

- run the cron direcly as postgres
- echo "select foo from bar" | psql ...


or:

write your sql-query i a file and "psql -f file"

> 
> I have the probelm that I am allways asked for the password - I did not
> find a way how to pass the password. 

put it in the ~/.psqlrc


> 
> Also I like to direct the result to a file, I assume I can do this via >

yes, this is possible.


Regards, Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net===    Schollglas Unternehmensgruppe    === 


pgsql-sql by date:

Previous
From: Thomas Pundt
Date:
Subject: Re: postgres on the comman line
Next
From: Achilleus Mantzios
Date:
Subject: Re: postgres on the comman line