citusdata / pg_cron

Run periodic jobs in PostgreSQL
PostgreSQL License
2.91k stars 195 forks source link

pg_cron not doing scheduled jobs (insert query) #112

Open msinphilpk opened 4 years ago

msinphilpk commented 4 years ago

Hi,

I've successfully installed and added pg_cron 12 on my PostgreSQL 12. Scheduling jobs also were successful, it reflects on 'cron.job' table. The jobs were some insert queries which fetch data from one table and insert them to another, in the same database.

Example: database=#SELECT cron.schedule(' ', $$INSERT INTO table2 (colname) SELECT COUNT() FROM table2$$); Also tried with, database=#SELECT cron.schedule(' ', $$INSERT INTO table2 (colname) SELECT COUNT() FROM table2;$$);

But the scheduled jobs were not done. Also, when I try to unschedule the jobs using specific jobid, it shows an error.

ERROR: could not find valid entry for job 10

Kindly, guide me how to overcome this problem. If there is any bug, please fix it as soon as possible.

Thank You.

msinphilpk commented 4 years ago

The original posted issue #112 had some stars (asterisk) in the example pg_cron schedule queries, but not reflected after submission. For example, there were 5 stars (asterisk) in time options in the schedule query and there is one asterisk inside the rounded braces of COUNT in the query. Please consider them.

Tezz28 commented 4 years ago

have you checked the following entry in the postgresql.conf file?

cron.database_name = 'postgres'

here database name is postgres in this case. check for your database name here.