3

I'm new in PostgreSQL, and I want to create a scheduled job which is run every day.

Firstly I'm creating a function for this. my function is working fine.

And now I want to create jobs and use this function inside the jobs, so it runs every day.

But I don't know how do this. I've been googling but didn't find any reference.

Please help

enter image description here

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Nayeem Mansoori
  • 821
  • 1
  • 15
  • 41

1 Answers1

0

Kindly follow the below steps:

Step 1: install pgAgent using application stack builder of postgres

Step 2:execute schema pgagent.sql in maintainance DB.follow this https://www.pgadmin.org/docs/pgadmin4/dev/pgagent_install.html link.

Step 3:Execute Following Command to pgAgent bin directory.

   pgAgent REMOVE pgAgent

   pgAgent INSTALL pgAgent -u system_username -p system_password 
    hostaddr=127.0.0.1 dbname=xyz 
    user=postgres_password=password_for_database

Step 4: Create job. follow this https://www.pgadmin.org/docs/pgadmin4/dev/pgagent_jobs.html link. in the sql You have to write select your_func_name();.

Step 5: Start job service using below command

    net start pgAgent