Regular function

Started by Yuriy Rusinovabout 13 years ago10 messagesgeneral
Jump to latest
#1Yuriy Rusinov
yrusinov@gmail.com

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.

#2John R Pierce
pierce@hogranch.com
In reply to: Yuriy Rusinov (#1)
Re: Regular function

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

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

#3John R Pierce
pierce@hogranch.com
In reply to: John R Pierce (#2)
Re: Regular function

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

#4Michael Paquier
michael@paquier.xyz
In reply to: John R Pierce (#2)
Re: Regular function

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

#5Yuriy Rusinov
yrusinov@gmail.com
In reply to: John R Pierce (#3)
Re: Regular function

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&lt;http://www.pgadmin.org/docs/1.16/pgagent.html&gt;

--
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&lt;http://www.postgresql.org/mailpref/pgsql-general&gt;

--
Best regards,
Sincerely yours,
Yuriy Rusinov.

#6ajmcello
ajmcello78@gmail.com
In reply to: Yuriy Rusinov (#1)
Re: Regular function

unsubscribe

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

Show quoted text

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.

#7ajmcello
ajmcello78@gmail.com
In reply to: Yuriy Rusinov (#1)
Re: Regular function

unsubscribe

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

Show quoted text

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.

#8Adrian Klaver
adrian.klaver@aklaver.com
In reply to: ajmcello (#7)
Re: Regular function

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

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

#9ajmcello
ajmcello78@gmail.com
In reply to: Adrian Klaver (#8)
Re: Regular function

unsubscribe

On Sat, Mar 30, 2013 at 9:07 PM, Adrian Klaver <adrian.klaver@gmail.com>wrote:

Show quoted text

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&lt;http://www.postgresql.org/mailpref/pgsql-general&gt;

--
Adrian Klaver
adrian.klaver@gmail.com

#10Yuriy Rusinov
yrusinov@gmail.com
In reply to: ajmcello (#9)
Re: Regular function

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.