Stored procedure in PostgreSQL

Started by Nonameabout 24 years ago5 messagesgeneral
Jump to latest
#1Noname
rrozboril@goldmann.sk

I would like to start stored procedure (function) at specific time and
repeate stored procedure every day.
Is it posible in PostgreSQl?

Thanks.

#2Arian Prins
prinsarian@zonnet.nl
In reply to: Noname (#1)
Re: Stored procedure in PostgreSQL

Basically you would use your operating-systems cron (or equivalent)
system.

1. Setup a query that executes the function, put it in a file;
2. add something like this to your crontab:
10 03 * * * /path-to-psql/psql < the-file-from-step-1
this would execute your at 10 minutes past 3 (in the morning), every day
(*) of every month (*) regardless of the weekday (*).

Read up on man crontab for more info.

Success,
Arian.

Robert schreef:

Show quoted text

I would like to start stored procedure (function) at specific time and
repeate stored procedure every day.
Is it posible in PostgreSQl?

Thanks.

#3Bo Lorentsen
bl@netgroup.dk
In reply to: Noname (#1)
Re: Stored procedure in PostgreSQL

On Wed, 2002-03-06 at 10:37, Robert wrote:

I would like to start stored procedure (function) at specific time and
repeate stored procedure every day.
Is it posible in PostgreSQl?

How about :

"psql -c \"SELECT my_func()\""

in your crontab ?

/BL

#4Marin Dimitrov
marin.dimitrov@sirma.bg
In reply to: Noname (#1)
Re: Stored procedure in PostgreSQL

----- Original Message -----
From: "Robert" <rrozboril@goldmann.sk>

I would like to start stored procedure (function) at specific time and
repeate stored procedure every day.
Is it posible in PostgreSQl?

what about writing a script that will be executed by crond every day?

the script should contain something like:

su -l postgres -c "psql -d DBNAME -c \"select * from ..... \" "

hth,

Marin

----
"...what you brought from your past, is of no use in your present. When
you must choose a new path, do not bring old experiences with you.
Those who strike out afresh, but who attempt to retain a little of the
old life, end up torn apart by their own memories. "

#5Jean-Michel POURE
jm.poure@freesurf.fr
In reply to: Noname (#1)
Re: Stored procedure in PostgreSQL

Le Mercredi 6 Mars 2002 10:37, Robert a écrit :

I would like to start stored procedure (function) at specific time and
repeate stored procedure every day.
Is it posible in PostgreSQl?

Run batch scripts (Windows) or cron jobs (Linux) excuting:
"psql databasename "SELECT function_foo()"
or "psql databasename < filename.sql"

Best regards,
Jean-Michel POURE