Re: Scheduled function ?

From: "Daniel T(dot) Staal" <DStaal(at)usa(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Scheduled function ?
Date: 2006-05-04 15:24:41
Message-ID: 55316.63.172.115.138.1146756281.squirrel@MageHandbook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, May 4, 2006 10:59 am, Aarni Ruuhimäki said:

> Yes, I thought so. What would the syntax of such a script ?
>
> Something like:
>
> #!/bin/bash
> #
>
> /usr/local/pgsql/bin/psql db_name
>
> run a function ?
>
> #eof

Depending on what I wanted to do, and how complex the function is, I'd
probably use:

#!/bin/sh
/usr/local/pgsql/bin/psql -c "SQL_Function_Call" db_name username
#EOF

You could also write the SQL to a file and have cron call
`/usr/local/pgsql/bin/psql -f SQL_file db_name username`.

(If there is output you might want to put that someplace as well.)

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Aarni Ruuhimäki 2006-05-04 16:10:00 Re: Scheduled function ?
Previous Message Christoph Frick 2006-05-04 15:04:26 Re: Scheduled function ?