Thread: Regular function

Regular function

From
Yuriy Rusinov
Date:
Hello colleagues !

I have to write pl/pgsql function that has to be triggered not before/after insert, but in definite time. Does postgresql allows to do this ? 

Thanks a lot.

--
Best regards,
Sincerely yours,
Yuriy Rusinov.

Re: Regular function

From
John R Pierce
Date:
On 3/29/2013 10:54 AM, Yuriy Rusinov wrote:
> I have to write pl/pgsql function that has to be triggered not
> before/after insert, but in definite time. Does postgresql allows to
> do this ?


there is no 'cron' built into postgresql.   you could write your
function, then have an external cron job invoke it, like: psql -c
"select yourfunction()"


--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: Regular function

From
John R Pierce
Date:
On 3/29/2013 11:13 AM, John R Pierce wrote:
> there is no 'cron' built into postgresql.

actually, there is pgAgent, which is associated with the pgAdmin
package, this implements a cron-like facility to postgres.

http://www.pgadmin.org/docs/1.16/pgagent.html



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: Regular function

From
Michael Paquier
Date:



On Sat, Mar 30, 2013 at 3:13 AM, John R Pierce <pierce@hogranch.com> wrote:
On 3/29/2013 10:54 AM, Yuriy Rusinov wrote:
I have to write pl/pgsql function that has to be triggered not before/after insert, but in definite time. Does postgresql allows to do this ?


there is no 'cron' built into postgresql.   you could write your function, then have an external cron job invoke it, like: psql -c "select yourfunction()"
Note also that if you are planning some development with the coming release 9.3, you could also achieve that inside the server by using a custom bgworker.
--
Michael

Re: Regular function

From
Yuriy Rusinov
Date:
Thanks a lot.


On Fri, Mar 29, 2013 at 10:22 PM, John R Pierce <pierce@hogranch.com> wrote:
On 3/29/2013 11:13 AM, John R Pierce wrote:
there is no 'cron' built into postgresql.

actually, there is pgAgent, which is associated with the pgAdmin package, this implements a cron-like facility to postgres.

http://www.pgadmin.org/docs/1.16/pgagent.html




--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
Best regards,
Sincerely yours,
Yuriy Rusinov.

Re: Regular function

From
ajmcello
Date:
unsubscribe


On Fri, Mar 29, 2013 at 10:54 AM, Yuriy Rusinov <yrusinov@gmail.com> wrote:
Hello colleagues !

I have to write pl/pgsql function that has to be triggered not before/after insert, but in definite time. Does postgresql allows to do this ? 

Thanks a lot.

--
Best regards,
Sincerely yours,
Yuriy Rusinov.

Re: Regular function

From
ajmcello
Date:
unsubscribe


On Fri, Mar 29, 2013 at 10:54 AM, Yuriy Rusinov <yrusinov@gmail.com> wrote:
Hello colleagues !

I have to write pl/pgsql function that has to be triggered not before/after insert, but in definite time. Does postgresql allows to do this ? 

Thanks a lot.

--
Best regards,
Sincerely yours,
Yuriy Rusinov.

Re: Regular function

From
Adrian Klaver
Date:
On 03/30/2013 08:42 PM, ajmcello wrote:
> unsubscribe
>

If you want to unsubscribe:

To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




--
Adrian Klaver
adrian.klaver@gmail.com


Re: Regular function

From
ajmcello
Date:
unsubscribe


On Sat, Mar 30, 2013 at 9:07 PM, Adrian Klaver <adrian.klaver@gmail.com> wrote:
On 03/30/2013 08:42 PM, ajmcello wrote:
unsubscribe


If you want to unsubscribe:


To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




--
Adrian Klaver
adrian.klaver@gmail.com

Re: Regular function

From
Yuriy Rusinov
Date:
Hello !

One's more question arises. In my function sometimes I have to init random number generator via  gsl_rng * r = gsl_rng_alloc (gsl_rng_taus); see http://www.gnu.org/software/gsl/manual/html_node/Random-number-generator-initialization.html, may I keep this generator between connections to database ?

Thanks a lot.
Yuriy Rusinov.