If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > pl/pgsql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-09-11, 15:56
rradu rradu is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
Question pl/pgsql

hello
i want to create a script which could activate itself when a condition in a table is met. whell my problem is that i didn;t found a way to create a such script, another ideea would be that to create a function which check a table each second and if a condition is met to run another function.
the last option is acceptabe thus the first one is ideeal
the real problem is that for second solution (to run a script each second) i found such thing only in oracle pl/sql(dbms sheduler), so i'm asking : is there something similar for pl/pgsql to do that?
of, if you have a solution for first case (the autocheck) please let me know
Reply With Quote
  #2 (permalink)  
Old 12-09-11, 17:58
dm1 dm1 is offline
Registered User
 
Join Date: Dec 2011
Posts: 13
There is pgAgent (http://www.pgadmin.org/docs/1.8/pgagent.html), have a look.

Dmitry
--

http://www.sqlines.com - Free online SQL conversion tool
Reply With Quote
  #3 (permalink)  
Old 12-09-11, 18:02
dm1 dm1 is offline
Registered User
 
Join Date: Dec 2011
Posts: 13
Quote:
Originally Posted by rradu View Post
hello
i want to create a script which could activate itself when a condition in a table is met.
Is it DML condition (INSERT/UPDATE/DELETE on table)? Probably you can use a trigger (CREATE TRIGGER). They were invented for this

Dmitry
--

http://www.sqlines.com - Free online SQL conversion tool
Reply With Quote
  #4 (permalink)  
Old 12-10-11, 06:07
rradu rradu is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
thanck you for your help but i don't think that will help me:
in pgadmin i didn't see such thing as interfal of one second, he is mostly like a cron job, with minimum 1 minute interval
secondly trigers are not a option since this this action will start when a value in a table will be equal with system time, not on a update/delete etc...

anyway here is oracle's dbms_scheduler they can run a scripteach second, i hope there is a similar thing in postgres to do that
Reply With Quote
  #5 (permalink)  
Old 12-10-11, 06:20
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
Quote:
Originally Posted by rradu View Post
anyway here is oracle's dbms_scheduler they can run a scripteach second, i hope there is a similar thing in postgres to do that
That's what pgAgent is.

See dm1's first answer (it includes the link)
Reply With Quote
Reply

Tags
dbms, pl/pgsql, scheduler

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On