Re: postgres on the comman line

From: "A(dot) Kretschmer" <akretschmer(at)despammed(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: postgres on the comman line
Date: 2005-09-22 14:15:06
Message-ID: 20050922141506.GE12957@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 ===

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Achilleus Mantzios 2005-09-22 14:19:31 Re: postgres on the comman line
Previous Message Thomas Pundt 2005-09-22 14:13:10 Re: postgres on the comman line