Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package pg_cron for openSUSE:Factory checked 
in at 2026-10-17 21:27:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/pg_cron (Old)
 and      /work/SRC/openSUSE:Factory/.pg_cron.new.3698736 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "pg_cron"

Sat Oct 17 21:27:35 2026 rev:16 rq:1385516 version:1.6.8

Changes:
--------
--- /work/SRC/openSUSE:Factory/pg_cron/pg_cron.changes  2026-05-06 
19:23:37.955277821 +0200
+++ /work/SRC/openSUSE:Factory/.pg_cron.new.3698736/pg_cron.changes     
2026-10-17 21:27:46.012801002 +0200
@@ -1,0 +2,16 @@
+Tue Sep  8 15:37:56 UTC 2026 - Marcus Rueckert <[email protected]>
+
+- update to 1.6.8
+  https://github.com/citusdata/pg_cron/releases/tag/v1.6.8
+- revert previous llvm/clang fix as it is now properly fixed in
+  postgresqlXY
+
+-------------------------------------------------------------------
+Wed Aug 19 09:55:37 UTC 2026 - Dominique Leuenberger <[email protected]>
+
+- BuildRequire llvm and clang to enable llvm/jit bitcode
+  generation. LLVM packaging no longer handles /usr/bin/llvm by
+  update-alternatives, and pgxs.mk strictly checks for
+  /usr/bin/clang and /usr/bin/llvm-lto.
+
+-------------------------------------------------------------------

Old:
----
  pg_cron-1.6.7.tar.gz

New:
----
  pg_cron-1.6.8.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ pg_cron.spec ++++++
--- /var/tmp/diff_new_pack.6Tyeqj/_old  2026-10-17 21:27:46.694829496 +0200
+++ /var/tmp/diff_new_pack.6Tyeqj/_new  2026-10-17 21:27:46.696829579 +0200
@@ -21,7 +21,7 @@
 %{pg_version_from_name}
 
 Name:           %{pg_name}-%{ext_name}
-Version:        1.6.7
+Version:        1.6.8
 Release:        0
 Summary:        PostgreSQL module for simple job schedule
 License:        PostgreSQL

++++++ pg_cron-1.6.7.tar.gz -> pg_cron-1.6.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pg_cron-1.6.7/.gitignore new/pg_cron-1.6.8/.gitignore
--- old/pg_cron-1.6.7/.gitignore        2025-09-04 12:17:08.000000000 +0200
+++ new/pg_cron-1.6.8/.gitignore        2026-09-08 16:16:13.000000000 +0200
@@ -1,5 +1,6 @@
 # Global excludes across all subdirectories
 *.o
+*.obj
 *.so
 *.so.[0-9]
 *.so.[0-9].[0-9]
@@ -8,6 +9,8 @@
 *.sl.[0-9].[0-9]
 *.dylib
 *.dll
+*.lib
+*.exp
 *.a
 *.mo
 *.pot
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pg_cron-1.6.7/CHANGELOG.md 
new/pg_cron-1.6.8/CHANGELOG.md
--- old/pg_cron-1.6.7/CHANGELOG.md      2025-09-04 12:17:08.000000000 +0200
+++ new/pg_cron-1.6.8/CHANGELOG.md      2026-09-08 16:16:13.000000000 +0200
@@ -1,3 +1,30 @@
+### pg_cron v1.6.8 (September 8, 2026) ###
+
+* Add PostgreSQL 19 support by @CyberDem0n in 
https://github.com/citusdata/pg_cron/pull/430
+* Add native Windows build support by @codercms in 
https://github.com/citusdata/pg_cron/pull/431
+* Fix native Windows regression tests to use the pg_cron test database
+* Improve MinGW build support by @robe2 and @rjd15372 in 
https://github.com/citusdata/pg_cron/pull/428, 
https://github.com/citusdata/pg_cron/pull/437, and 
https://github.com/citusdata/pg_cron/pull/439
+* Add the cron.dom_dow_and_logic setting by @vdjakovic in 
https://github.com/citusdata/pg_cron/pull/421
+* Fix a shutdown hang with synchronous replication by @CyberDem0n in 
https://github.com/citusdata/pg_cron/pull/414
+* Fix a shared-memory queue handle leak in the launcher process by @dubek in 
https://github.com/citusdata/pg_cron/pull/420
+* Invalidate the job cache when the relation ID is invalid by @za-arthur in 
https://github.com/citusdata/pg_cron/commit/f6771508067390433b68ab1ca9cf2269018da42d
+* Fix use of an uninitialized variable by @CyberDem0n in 
https://github.com/citusdata/pg_cron/pull/413
+* Preserve compatibility with the v1.3 cron.schedule named-job signature by 
@CyberDem0n in https://github.com/citusdata/pg_cron/pull/411
+* Keep role ownership checks case-sensitive by @ihalatci in 
https://github.com/citusdata/pg_cron/pull/425
+* Fix getrlimit return value handling by @GalenSha in 
https://github.com/citusdata/pg_cron/pull/436
+
+### pg_cron v1.6.7 (September 4, 2025) ###
+
+* Fix compile errors on newer versions of GCC @marcoslot in 
https://github.com/citusdata/pg_cron/pull/403
+
+### pg_cron v1.6.6 (September 4, 2025) ###
+
+* Postgres 18 support by @AndrewJackson2020 @esiaero @francoricci
+* Stop logging notices and repeating log messages by @marcoslot in 
https://github.com/citusdata/pg_cron/pull/378
+* Fixes a possible crash for unavailable cron jobs @SeleznevPavel in 
https://github.com/citusdata/pg_cron/pull/370
+* Fix build issue FreeBSD 14.3 @francoricci in 
https://github.com/citusdata/pg_cron/pull/394
+* Fix type mismatch in dsm_attach() argument by using DatumGetUInt32() by 
@yjhjstz in https://github.com/citusdata/pg_cron/pull/395
+
 ### pg_cron v1.6.5 (December 12, 2024) ###
 
 * Fix superuser check before adding job to CronJobHash by @CyberDem0n in 
https://github.com/citusdata/pg_cron/pull/367
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pg_cron-1.6.7/Makefile new/pg_cron-1.6.8/Makefile
--- old/pg_cron-1.6.7/Makefile  2025-09-04 12:17:08.000000000 +0200
+++ new/pg_cron-1.6.8/Makefile  2026-09-08 16:16:13.000000000 +0200
@@ -12,9 +12,9 @@
 MODULE_big = $(EXTENSION)
 OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
 ifeq ($(CC),gcc)
-    PG_CPPFLAGS = -std=c99 -Wall -Wextra -Werror -Wno-unused-parameter 
-Wno-uninitialized -Wno-implicit-fallthrough -Iinclude -I$(libpq_srcdir)
+    PG_CPPFLAGS = -std=gnu11 -Wall -Wextra -Werror -Wno-unused-parameter 
-Wno-uninitialized -Wno-implicit-fallthrough -Iinclude -I$(libpq_srcdir)
 else
-    PG_CPPFLAGS = -std=c99 -Wall -Wextra -Werror -Wno-unused-parameter 
-Wno-implicit-fallthrough -Iinclude -I$(libpq_srcdir)
+    PG_CPPFLAGS = -std=gnu11 -Wall -Wextra -Werror -Wno-unused-parameter 
-Wno-implicit-fallthrough -Iinclude -I$(libpq_srcdir)
 endif
 ifeq ($(shell uname -s),SunOS)
     PG_CPPFLAGS += -Wno-sign-compare -D__EXTENSIONS__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pg_cron-1.6.7/Makefile.win 
new/pg_cron-1.6.8/Makefile.win
--- old/pg_cron-1.6.7/Makefile.win      1970-01-01 01:00:00.000000000 +0100
+++ new/pg_cron-1.6.8/Makefile.win      2026-09-08 16:16:13.000000000 +0200
@@ -0,0 +1,63 @@
+# src/test/modules/pg_cron/Makefile.win
+
+EXTENSION = pg_cron
+
+DATA_built = $(EXTENSION)--1.0.sql
+
+REGRESS_OPTS = --temp-config=./pg_cron.conf --temp-instance=./tmp_check 
--dbname=contrib_regression
+REGRESS = pg_cron-test
+
+OBJS = src/entry.obj src/job_metadata.obj src/misc.obj src/pg_cron.obj 
src/task_states.obj
+OBJS_CLEAN = src\entry.obj src\job_metadata.obj src\misc.obj src\pg_cron.obj 
src\task_states.obj
+
+# TODO use pg_config
+!ifndef PGROOT
+!error PGROOT is not set
+!endif
+BINDIR = $(PGROOT)\bin
+INCLUDEDIR = $(PGROOT)\include
+INCLUDEDIR_SERVER = $(PGROOT)\include\server
+LIBDIR = $(PGROOT)\lib
+PKGLIBDIR = $(PGROOT)\lib
+SHAREDIR = $(PGROOT)\share
+
+# Use $(PGROOT)\bin\pg_regress for Postgres < 17
+PG_REGRESS = $(LIBDIR)\pgxs\src\test\regress\pg_regress
+
+CFLAGS = /nologo /DWIN32_NO_STATUS /Dstrcasecmp=_stricmp 
/I"$(INCLUDEDIR_SERVER)\port\win32_msvc" /I"$(INCLUDEDIR_SERVER)\port\win32" 
/I"$(INCLUDEDIR_SERVER)" /I"$(INCLUDEDIR)" /Iinclude /Isrc
+
+SHLIB = $(EXTENSION).dll
+
+LIBS = "$(LIBDIR)\postgres.lib" "$(LIBDIR)\libpq.lib" "$(LIBDIR)\libintl.lib" 
ws2_32.lib
+
+all: $(SHLIB) $(DATA_built)
+
+.c.obj:
+       $(CC) $(CFLAGS) /c $< /Fo$@
+
+$(SHLIB): $(OBJS)
+       $(CC) $(CFLAGS) $(OBJS) $(LIBS) /link /DLL /OUT:$(SHLIB)
+
+$(EXTENSION)--1.0.sql: $(EXTENSION).sql
+       copy $(EXTENSION).sql $@
+
+install: all
+       if not exist "$(SHAREDIR)\extension" mkdir "$(SHAREDIR)\extension"
+       copy $(EXTENSION).control "$(SHAREDIR)\extension\"
+       copy $(DATA_built) "$(SHAREDIR)\extension\"
+       for %f in ($(EXTENSION)--*--*.sql) do copy "%f" "$(SHAREDIR)\extension\"
+       copy $(SHLIB) "$(PKGLIBDIR)\"
+
+installcheck:
+       "$(PG_REGRESS)" --bindir="$(BINDIR)" $(REGRESS_OPTS) $(REGRESS)
+
+uninstall:
+       del /f "$(PKGLIBDIR)\$(SHLIB)"
+       del /f "$(SHAREDIR)\extension\$(EXTENSION).control"
+       del /f "$(SHAREDIR)\extension\$(EXTENSION)--*.sql"
+
+clean:
+       del /f $(SHLIB) $(EXTENSION).lib $(EXTENSION).exp
+       del /f $(DATA_built)
+       del /f $(OBJS_CLEAN)
+       del /f /s /q results regression.diffs regression.out tmp_check 
tmp_check_iso log output_iso
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pg_cron-1.6.7/README.md new/pg_cron-1.6.8/README.md
--- old/pg_cron-1.6.7/README.md 2025-09-04 12:17:08.000000000 +0200
+++ new/pg_cron-1.6.8/README.md 2026-09-08 16:16:13.000000000 +0200
@@ -1,58 +1,51 @@
 [![Citus Banner](/github-banner.png)](https://www.citusdata.com/)
 
-## What is pg_cron?
+# What is pg_cron?
 
-pg_cron is a simple cron-based job scheduler for PostgreSQL (10 or higher) 
that runs inside the database as an extension. It uses the same syntax as 
regular cron, but it allows you to schedule PostgreSQL commands directly from 
the database. You can also use '[1-59] seconds' to schedule a job based on an 
interval.
+pg_cron is a simple cron-based job scheduler for PostgreSQL (10 or higher) 
that runs inside the database as an extension. 
 
-pg_cron also allows you using '$' to indicate last day of the month.
+---
 
-```sql
--- Delete old data on Saturday at 3:30am (GMT)
-SELECT cron.schedule('30 3 * * 6', $$DELETE FROM events WHERE event_time < 
now() - interval '1 week'$$);
- schedule
-----------
-       42
+# Contents
+- [How pg_cron works](#how-pg_cron-works)
+- [Cron syntax](#cron-syntax)
+- [Managing and creating jobs](#managing-and-creating-jobs)
+       - [Creating a cron job](#creating-a-cron-job)
+       - [Creating a cron job in a different 
database](#creating-a-cron-job-in-a-different-database)
+       - [Removing a cron job](#removing-a-cron-job)
+       - [Altering a cron job](#altering-a-cron-job)
+- [Installing pg_cron](#installing-pg_cron)
+- [Setting up pg_cron](#setting-up-pg_cron)
+- [Monitoring jobs](#monitoring-jobs)
+- [Example use cases](#example-use-cases)
+- [Managed services](#managed-services)
+- [Code of Conduct](#code-of-conduct)
 
--- Vacuum every day at 10:00am (GMT)
-SELECT cron.schedule('nightly-vacuum', '0 10 * * *', 'VACUUM');
- schedule
-----------
-       43
-
--- Change to vacuum at 3:00am (GMT)
-SELECT cron.schedule('nightly-vacuum', '0 3 * * *', 'VACUUM');
- schedule
-----------
-       43
-
--- Stop scheduling jobs
-SELECT cron.unschedule('nightly-vacuum' );
- unschedule 
-------------
- t
+---
 
-SELECT cron.unschedule(42);
- unschedule
-------------
-          t
-
--- Vacuum every Sunday at 4:00am (GMT) in a database other than the one 
pg_cron is installed in
-SELECT cron.schedule_in_database('weekly-vacuum', '0 4 * * 0', 'VACUUM', 
'some_other_database');
- schedule
-----------
-       44
+# How pg_cron works
 
--- Call a stored procedure every 5 seconds
-SELECT cron.schedule('process-updates', '5 seconds', 'CALL process_updates()');
+The extension creates a background worker that tracks jobs in the `cron.job` 
table.
 
--- Process payroll at 12:00 of the last day of each month
-SELECT cron.schedule('process-payroll', '0 12 $ * *', 'CALL 
process_payroll()');
+```sql
+CREATE TABLE cron.job (
+       jobid bigint primary key default pg_catalog.nextval('cron.jobid_seq'),
+       schedule text not null,
+       command text not null,
+       nodename text not null default 'localhost',
+       nodeport int not null default pg_catalog.inet_server_port(),
+       database text not null default pg_catalog.current_database(),
+       username text not null default current_user
+);
 ```
 
-pg_cron can run multiple jobs in parallel, but it runs at most one instance of 
a job at a time. If a second run is supposed to start before the first one 
finishes, then the second run is queued and started as soon as the first run 
completes.
+Based on your configurations, to execute a job, the extension establishes a 
Postgres connection or spawns a database worker. 
+
+pg_cron can run multiple jobs in parallel, but only one instance of each 
specific job at a time. If a second instance is triggered before the first 
finishes, it’s queued and starts as soon as the first one completes.
 
-The schedule uses the standard cron syntax, in which * means "run every time 
period", and a specific number means "but only at this time":
+# Cron syntax
 
+The code in pg_cron that handles parsing and scheduling comes directly from 
the [cron source code by Paul Vixie](https://github.com/vixie/cron), hence the 
same options are supported.
 ```
  ┌───────────── min (0 - 59)
  │ ┌────────────── hour (0 - 23)
@@ -67,22 +60,230 @@
 
 An easy way to create a cron schedule is: [crontab.guru](http://crontab.guru/).
 
-The code in pg_cron that handles parsing and scheduling comes directly from 
the cron source code by Paul Vixie, hence the same options are supported.
+pg_cron also allows you:
+- to use `$` to indicate last day of the month.
+- to use `[1-59] seconds` to schedule a job based on an interval. Note, you 
cannot use seconds with the other time units.
+
+
+Example cron schedules:
+
+```
+'10 seconds'  # every 10 seconds
+* * * * *     # every minute
+*/5 * * * *   # every 5 minutes
+0 * * * *     # every hour
+0 0 * * *     # daily at 12AM
+0 0 * * 1-5   # 12AM every weekday
+0 1 * * 0     # 1AM every Sunday
+0 13 2 6 *    # 1PM on the 2nd of June
+```
+
+# Managing and creating jobs
+
+Cron jobs can be managed by directly interacting with the `cron.job` table if 
you have the required permissions. However, it is recommended to use the cron 
functions:
+- [`cron.schedule`](#creating-a-cron-job)
+- [`cron.schedule_in_database`](#creating-a-cron-job-in-a-different-database)
+- [`cron.unschedule`](#removing-a-cron-job)
+- [`cron.alter_job`](#altering-a-cron-job)
+
+> Note, an [RLS 
policy](https://www.postgresql.org/docs/current/ddl-rowsecurity.html) ensures 
that jobs can only be seen and modified by the user that created them, unless 
the user is a superuser or has the `bypassrls` attribute.
+
+### Creating a cron job
+
+#### `cron.schedule` signatures
+```sql
+-- create job, return jobid
+CREATE OR REPLACE FUNCTION cron.schedule(schedule text, command text)
+RETURNS bigint;
+
+-- create named job, return jobid
+CREATE OR REPLACE FUNCTION cron.schedule(job_name text, schedule text, command 
text)
+RETURNS bigint
+```
+
+#### Examples
+
+##### Create a cron job
+
+```sql
+-- Delete old data on Saturday at 3:30am (GMT)
+SELECT cron.schedule(
+       '30 3 * * 6', 
+       $$DELETE FROM events WHERE event_time < now() - interval '1 week'$$
+);
+-- returns cron id
+```
+
+##### Create a named cron job
+
+```sql
+-- Vacuum every day at 10:00am (GMT)
+SELECT cron.schedule(
+       'nightly-vacuum', 
+       '0 10 * * *', 
+       'VACUUM'
+);
+-- returns cron id
+```
+
+##### Create a job that runs every 30 seconds
+
+```sql
+-- run SELECT 1 every 30 seconds
+SELECT cron.schedule(
+       'run_every_30_seconds', 
+       '30 seconds', 
+       'SELECT 1'
+);
+-- returns cron id
+```
+
+##### Create a job that calls a stored procedure every 5 seconds
+
+```sql
+-- Call a stored procedure every 5 seconds
+SELECT cron.schedule(
+       'process-updates',
+       '5 seconds',
+       'CALL process_updates()'
+);
+-- returns cron id
+```
+
+##### Create a job that processes payroll at 12:00 of the last day of each 
month
+
+```sql
+-- Process payroll at 12:00 of the last day of each month
+SELECT cron.schedule(
+       'process-payroll',
+       '0 12 $ * *',
+       'CALL process_payroll()'
+);
+-- returns cron id
+```
+
+### Creating a cron job in a different database
+
+#### `cron.schedule_in_database` signature
+```sql
+-- create job, return jobid
+CREATE OR REPLACE FUNCTION cron.schedule_in_database(
+       job_name text, 
+       schedule text, 
+       command text, 
+       database text, 
+       username text DEFAULT NULL::text, 
+       active boolean DEFAULT true
+)
+RETURNS bigint
+```
+
+#### Example
+
+##### Create a cron job in a different database
+
+```sql
+-- Delete old data on Saturday at 3:30am (GMT)
+SELECT cron.schedule_in_database(
+       'delete_old_data', 
+       '30 3 * * 6', 
+       $$DELETE FROM events WHERE event_time < now() - interval '1 week'$$,
+       'some_other_database'
+);
+-- returns cron id
+```
+
+### Removing a cron job
+
+#### `cron.unschedule` signatures
+```sql
+-- remove job by name, return true if job was removed
+CREATE OR REPLACE FUNCTION cron.unschedule(job_name text)
+RETURNS boolean
+
+-- remove job by id, return true if job was removed
+CREATE OR REPLACE FUNCTION cron.unschedule(job_id bigint)
+RETURNS boolean
+```
+
+#### Examples
+
+##### Remove a named cron job
+
+```sql
+-- delete job by name
+SELECT cron.unschedule('nightly-vacuum');
+-- returns true if job was removed
+```
+
+##### Remove a cron job by id
+
+```sql
+-- delete job by id
+SELECT cron.unschedule(42);
+-- returns true if job was removed
+```
+
+### Altering a cron job
+
+#### `cron.alter_job` signature
+```sql
+CREATE OR REPLACE FUNCTION cron.alter_job(
+       job_id bigint, 
+       schedule text DEFAULT NULL::text, 
+       command text DEFAULT NULL::text, 
+       database text DEFAULT NULL::text, 
+       username text DEFAULT NULL::text, 
+       active boolean DEFAULT NULL::boolean
+)
+RETURNS void
+```
+
+#### Examples
 
-## Installing pg_cron
+##### Change a job's schedule
 
-Install on Red Hat, CentOS, Fedora, Amazon Linux with PostgreSQL 16 using 
[PGDG](https://yum.postgresql.org/repopackages/):
+```sql
+-- change job's schedule
+SELECT cron.alter_job(42, '0 10 * * *');
+-- returns void
+```
+
+##### Change a job's, schedule, command, and username
+
+```sql
+-- change job's command
+SELECT cron.alter_job(
+       42,
+       '0 10 * * *',
+       'VACUUM',
+       username := 'some_other_user'
+);
+-- returns void
+```
+
+##### Deactivate a job
+
+```sql
+-- deactivate job
+SELECT cron.alter_job(42, active := false);
+-- returns void
+```
+
+# Installing pg_cron
+
+Install on Red Hat, CentOS, Fedora, Amazon Linux with PostgreSQL 18 using 
[PGDG](https://yum.postgresql.org/repopackages/):
 
 ```bash
 # Install the pg_cron extension
-sudo yum install -y pg_cron_16
+sudo yum install -y pg_cron_18
 ```
 
-Install on Debian, Ubuntu with PostgreSQL 16 using 
[apt.postgresql.org](https://wiki.postgresql.org/wiki/Apt):
+Install on Debian, Ubuntu with PostgreSQL 18 using 
[apt.postgresql.org](https://wiki.postgresql.org/wiki/Apt):
 
 ```bash
 # Install the pg_cron extension
-sudo apt-get -y install postgresql-16-cron
+sudo apt-get -y install postgresql-18-cron
 ```
 
 You can also install pg_cron by building it from source:
@@ -91,13 +292,36 @@
 git clone https://github.com/citusdata/pg_cron.git
 cd pg_cron
 # Ensure pg_config is in your path, e.g.
-export PATH=/usr/pgsql-16/bin:$PATH
+export PATH=/usr/pgsql-18/bin:$PATH
 make && sudo PATH=$PATH make install
 ```
 
-## Setting up pg_cron
+## Windows
+
+Ensure [C++ support in Visual 
Studio](https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#download-and-install-the-tools)
 is installed and run `x64 Native Tools Command Prompt for VS [version]` as 
administrator. Then use `nmake` to build:
+
+```cmd
+set "PGROOT=C:\Program Files\PostgreSQL\18"
+cd %TMP%
+git clone https://github.com/citusdata/pg_cron.git
+cd pg_cron
+nmake /F Makefile.win
+nmake /F Makefile.win install
+```
+
+### Installation Notes - Windows
+
+#### Missing Header
 
-To start the pg_cron background worker when PostgreSQL starts, you need to add 
pg_cron to `shared_preload_libraries` in postgresql.conf. Note that pg_cron 
does not run any jobs as a long a server is in [hot 
standby](https://www.postgresql.org/docs/current/static/hot-standby.html) mode, 
but it automatically starts when the server is promoted.
+If compilation fails with `Cannot open include file: 'postgres.h': No such 
file or directory`, make sure `PGROOT` is correct.
+
+#### Permissions
+
+If installation fails with `Access is denied`, re-run the installation 
instructions as an administrator.
+
+# Setting up pg_cron
+
+To start the pg_cron background worker, you need to add pg_cron to 
`shared_preload_libraries` in postgresql.conf. Note that pg_cron does not run 
any jobs as a long a server is in [hot 
standby](https://www.postgresql.org/docs/current/static/hot-standby.html) mode, 
but it automatically starts when the server is promoted.
 
 ```
 # add to postgresql.conf
@@ -163,35 +387,6 @@
 select * from cron.job;
 ```
 
-## Viewing job run details
-
-You can view the status of running and recently completed job runs in the 
`cron.job_run_details`:
-
-```sql
-select * from cron.job_run_details order by start_time desc limit 5;
-┌───────┬───────┬─────────┬──────────┬──────────┬───────────────────┬───────────┬──────────────────┬───────────────────────────────┬───────────────────────────────┐
-│ jobid │ runid │ job_pid │ database │ username │      command      │  status  
 │  return_message  │          start_time           │           end_time        
    │
-├───────┼───────┼─────────┼──────────┼──────────┼───────────────────┼───────────┼──────────────────┼───────────────────────────────┼───────────────────────────────┤
-│    10 │  4328 │    2610 │ postgres │ marco    │ select process()  │ 
succeeded │ SELECT 1         │ 2023-02-07 09:30:00.098164+01 │ 2023-02-07 
09:30:00.130729+01 │
-│    10 │  4327 │    2609 │ postgres │ marco    │ select process()  │ 
succeeded │ SELECT 1         │ 2023-02-07 09:29:00.015168+01 │ 2023-02-07 
09:29:00.832308+01 │
-│    10 │  4321 │    2603 │ postgres │ marco    │ select process()  │ 
succeeded │ SELECT 1         │ 2023-02-07 09:28:00.011965+01 │ 2023-02-07 
09:28:01.420901+01 │
-│    10 │  4320 │    2602 │ postgres │ marco    │ select process()  │ failed   
 │ server restarted │ 2023-02-07 09:27:00.011833+01 │ 2023-02-07 
09:27:00.72121+01  │
-│     9 │  4320 │    2602 │ postgres │ marco    │ select do_stuff() │ failed   
 │ job canceled     │ 2023-02-07 09:26:00.011833+01 │ 2023-02-07 
09:26:00.22121+01  │
-└───────┴───────┴─────────┴──────────┴──────────┴───────────────────┴───────────┴──────────────────┴───────────────────────────────┴───────────────────────────────┘
-(10 rows)
-```
-
-The records in `cron.job_run_details` are not cleaned automatically, but every 
user that can schedule cron jobs also has permission to delete their own 
`cron.job_run_details` records. 
-
-Especially when you have jobs that run every few seconds, it can be a good 
idea to clean up regularly, which can easily be done using pg_cron itself:
-
-```sql
--- Delete old cron.job_run_details records of the current user every day at 
noon
-SELECT  cron.schedule('delete-job-run-details', '0 12 * * *', $$DELETE FROM 
cron.job_run_details WHERE end_time < now() - interval '7 days'$$);
-```
-
-If you do not want to use `cron.job_run_details` at all, then you can add 
`cron.log_run = off` to `postgresql.conf`.
-
 ## Extension settings
 
 The pg_cron extension supports the following configuration parameters:
@@ -227,7 +422,42 @@
 
 All the other settings have a postmaster context and only take effect after a 
server restart.
 
-## Example use cases
+# Monitoring jobs
+
+### Reviewing the `cron.job_run_details` table
+
+You can view job activity in the `cron.job_run_details` table:
+
+```sql
+select * from cron.job_run_details order by start_time desc limit 5;
+┌───────┬───────┬─────────┬──────────┬──────────┬───────────────────┬───────────┬──────────────────┬───────────────────────────────┬───────────────────────────────┐
+│ jobid │ runid │ job_pid │ database │ username │      command      │  status  
 │  return_message  │          start_time           │           end_time        
    │
+├───────┼───────┼─────────┼──────────┼──────────┼───────────────────┼───────────┼──────────────────┼───────────────────────────────┼───────────────────────────────┤
+│    11 │  4328 │    2610 │ postgres │ marco    │ select pg_sleep(3)│ running  
 │ NULL             │ 2023-02-07 09:30:00.098164+01 │ NULL                      
    │
+│    10 │  4327 │    2609 │ postgres │ marco    │ select process()  │ 
succeeded │ SELECT 1         │ 2023-02-07 09:29:00.015168+01 │ 2023-02-07 
09:29:00.832308+01 │
+│    10 │  4321 │    2603 │ postgres │ marco    │ select process()  │ 
succeeded │ SELECT 1         │ 2023-02-07 09:28:00.011965+01 │ 2023-02-07 
09:28:01.420901+01 │
+│    10 │  4320 │    2602 │ postgres │ marco    │ select process()  │ failed   
 │ server restarted │ 2023-02-07 09:27:00.011833+01 │ 2023-02-07 
09:27:00.72121+01  │
+│     9 │  4320 │    2602 │ postgres │ marco    │ select do_stuff() │ failed   
 │ job canceled     │ 2023-02-07 09:26:00.011833+01 │ 2023-02-07 
09:26:00.22121+01  │
+└───────┴───────┴─────────┴──────────┴──────────┴───────────────────┴───────────┴──────────────────┴───────────────────────────────┴───────────────────────────────┘
+(10 rows)
+```
+
+The records in the table are not cleaned automatically, but every user that 
can schedule cron jobs also has permission to delete their own 
`cron.job_run_details` records. 
+
+Especially when you have jobs that run every few seconds, it can be a good 
idea to clean up regularly, which can easily be done using pg_cron itself:
+
+```sql
+-- Delete old cron.job_run_details records of the current user every day at 
noon
+SELECT  cron.schedule('delete-job-run-details', '0 12 * * *', $$DELETE FROM 
cron.job_run_details WHERE end_time < now() - interval '7 days'$$);
+```
+
+If you do not want to use `cron.job_run_details` at all, then you can add 
`cron.log_run = off` to `postgresql.conf`.
+
+### Other cron logging settings
+
+If the `cron.log_statement` setting is configured, jobs will be logged before 
execution. The `cron.log_min_messages` setting controls the [minimum level of 
messages](https://www.postgresql.org/docs/current/runtime-config-logging.html#RUNTIME-CONFIG-SEVERITY-LEVELS)
 that will be recorded.
+
+# Example use cases
 
 Articles showing possible ways of using pg_cron:
 
@@ -238,7 +468,7 @@
 * [Routinely invoking a 
function](https://fluca1978.github.io/2019/05/21/pgcron.html)
 * [Postgres as a cron 
server](https://supabase.io/blog/2021/03/05/postgres-as-a-cron-server)
 
-## Managed services
+# Managed services
 
 The following table keeps track of which of the major managed Postgres 
services support pg_cron.
 
@@ -248,18 +478,22 @@
 | [Alibaba Cloud](https://www.alibabacloud.com/help/doc-detail/150355.htm) | 
:heavy_check_mark: |
 | [Amazon RDS](https://aws.amazon.com/rds/postgresql/)     | 
:heavy_check_mark:      |          |
 | [Azure](https://azure.microsoft.com/en-us/services/postgresql/) | 
:heavy_check_mark:  |
+| [Clickhouse](https://clickhouse.com/docs/cloud/managed-postgres/extensions)  
| :heavy_check_mark:  |
 | [Crunchy 
Bridge](https://www.crunchydata.com/products/crunchy-bridge/?ref=producthunt) | 
:heavy_check_mark: |
 | [DigitalOcean](https://www.digitalocean.com/products/managed-databases/) | 
:heavy_check_mark: |
 | [Google Cloud](https://cloud.google.com/sql/postgresql/) | 
:heavy_check_mark: |
-| [Heroku](https://elements.heroku.com/addons/heroku-postgresql) | :x: | 
+| [Heroku](https://elements.heroku.com/addons/heroku-postgresql) | :x: |
 | [Instaclustr](https://instaclustr.com) | :heavy_check_mark:  |
-| [Neon](https://neon.tech/docs/extensions/extensions-intro#tooling-admin) | 
:heavy_check_mark: | 
+| [Lakebase](https://docs.databricks.com/aws/en/oltp/projects/extensions) | 
:x: |
+| [Neon](https://neon.tech/docs/extensions/extensions-intro#tooling-admin) | 
:heavy_check_mark: |
+| [PlanetScale](https://planetscale.com/docs/postgres/extensions) | 
:heavy_check_mark: |
 | [ScaleGrid](https://scalegrid.io/postgresql.html) | :heavy_check_mark:  |
 | [Scaleway](https://www.scaleway.com/en/database/) | :heavy_check_mark:  |
+| [Snowflake](https://www.scaleway.com/en/database/) | :heavy_check_mark:  |
 | [Supabase](https://supabase.io/docs/guides/database) | :heavy_check_mark:  |
-| [Tembo](https://tembo.io) | :heavy_check_mark:  |
+| [Ubicloud](https://www.ubicloud.com/docs/managed-postgresql/extensions) | 
:heavy_check_mark:  |
 | [YugabyteDB](https://www.yugabyte.com/) | :heavy_check_mark:  |
 
-## Code of Conduct
+# Code of Conduct
 
 This project has adopted the [Microsoft Open Source Code of 
Conduct](https://opensource.microsoft.com/codeofconduct/). For more information 
see the [Code of Conduct 
FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact 
[[email protected]](mailto:[email protected]) with any additional 
questions or comments.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pg_cron-1.6.7/expected/pg_cron-test.out 
new/pg_cron-1.6.8/expected/pg_cron-test.out
--- old/pg_cron-1.6.7/expected/pg_cron-test.out 2025-09-04 12:17:08.000000000 
+0200
+++ new/pg_cron-1.6.8/expected/pg_cron-test.out 2026-09-08 16:16:13.000000000 
+0200
@@ -5,6 +5,20 @@
  1.0
 (1 row)
 
+-- Test binary compatibility with v1.3 function signature.
+ALTER EXTENSION pg_cron UPDATE TO '1.3';
+SELECT cron.schedule('test', '* * * * *', 'SELECT 1');
+ schedule 
+----------
+        1
+(1 row)
+
+SELECT cron.unschedule('test');
+ unschedule 
+------------
+ t
+(1 row)
+
 -- Test binary compatibility with v1.4 function signature.
 ALTER EXTENSION pg_cron UPDATE TO '1.4';
 SELECT cron.unschedule(job_name := 'no_such_job');
@@ -12,7 +26,7 @@
 SELECT cron.schedule('testjob', '* * * * *', 'SELECT 1');
  schedule 
 ----------
-        1
+        2
 (1 row)
 
 SELECT cron.unschedule('testjob');
@@ -250,6 +264,20 @@
  pgcron_cront
 (1 row)
 
+-- Make sure ownership checks remain case-sensitive for quoted role names
+CREATE USER "CaseOwner";
+CREATE USER caseowner;
+GRANT USAGE ON SCHEMA cron TO "CaseOwner", caseowner;
+SELECT cron.schedule_in_database(job_name:='mixed case owner', schedule:='0 11 
* * *', command:='VACUUM',database:=current_database(), username:='CaseOwner');
+ schedule_in_database 
+----------------------
+                    8
+(1 row)
+
+SET SESSION AUTHORIZATION caseowner;
+SELECT cron.unschedule(8);
+ERROR:  permission denied for table job
+RESET SESSION AUTHORIZATION;
 -- Override function
 DROP EXTENSION IF EXISTS pg_cron cascade;
 CREATE TABLE test (data text);
@@ -325,5 +353,7 @@
 -- cleaning
 DROP EXTENSION pg_cron;
 drop user pgcron_cront;
+drop user "CaseOwner";
+drop user caseowner;
 drop database pgcron_dbno;
 drop database pgcron_dbyes;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pg_cron-1.6.7/include/cron.h 
new/pg_cron-1.6.8/include/cron.h
--- old/pg_cron-1.6.7/include/cron.h    2025-09-04 12:17:08.000000000 +0200
+++ new/pg_cron-1.6.8/include/cron.h    2026-09-08 16:16:13.000000000 +0200
@@ -28,7 +28,43 @@
 
 /* reorder these #include's at your peril */
 
+#ifndef WIN32_COMPAT_H
+#define WIN32_COMPAT_H
+
+#ifdef _WIN32
+#include <winsock2.h>
+#include <windows.h>
+
+
+
+/* Fix missing POSIX types */
+#ifndef uid_t
+typedef int uid_t;
+typedef int gid_t;
+#endif
+
+#ifndef uint
+typedef unsigned int uint;
+#endif
+
+/* Fix poll mapping */
+#define poll WSAPoll
+
+/* Stub out rlimit to satisfy the compiler without using port.h */
+struct rlimit {
+    uint rlim_cur;
+    uint rlim_max;
+};
+#define RLIMIT_NOFILE 0
+static inline int getrlimit(int resource, struct rlimit *rlp) { return 0; }
+
+#endif /* _WIN32 */
+#endif /* WIN32_COMPAT_H */
+
+
 #include <sys/types.h>
+
+
 #include <sys/param.h>
 
 #include <stdio.h>
@@ -156,8 +192,13 @@
 
 typedef        struct _entry {
        struct _entry   *next;
-       uid_t           uid;    
+    #if defined(_WIN32)
+       unsigned int    uid;
+       unsigned int    gid;
+       #else
+       uid_t           uid;
        gid_t           gid;
+       #endif
        char            **envp;
        int         secondsInterval;
        bitstr_t        bit_decl(minute, MINUTE_COUNT);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pg_cron-1.6.7/sql/pg_cron-test.sql 
new/pg_cron-1.6.8/sql/pg_cron-test.sql
--- old/pg_cron-1.6.7/sql/pg_cron-test.sql      2025-09-04 12:17:08.000000000 
+0200
+++ new/pg_cron-1.6.8/sql/pg_cron-test.sql      2026-09-08 16:16:13.000000000 
+0200
@@ -1,5 +1,9 @@
 CREATE EXTENSION pg_cron VERSION '1.0';
 SELECT extversion FROM pg_extension WHERE extname='pg_cron';
+-- Test binary compatibility with v1.3 function signature.
+ALTER EXTENSION pg_cron UPDATE TO '1.3';
+SELECT cron.schedule('test', '* * * * *', 'SELECT 1');
+SELECT cron.unschedule('test');
 -- Test binary compatibility with v1.4 function signature.
 ALTER EXTENSION pg_cron UPDATE TO '1.4';
 SELECT cron.unschedule(job_name := 'no_such_job');
@@ -134,6 +138,17 @@
 SELECT cron.schedule_in_database(job_name:='his vacuum', schedule:='0 11 * * 
*', command:='VACUUM',database:=current_database(), username:='pgcron_cront');
 SELECT username FROM cron.job where jobid=7;
 
+-- Make sure ownership checks remain case-sensitive for quoted role names
+CREATE USER "CaseOwner";
+CREATE USER caseowner;
+GRANT USAGE ON SCHEMA cron TO "CaseOwner", caseowner;
+
+SELECT cron.schedule_in_database(job_name:='mixed case owner', schedule:='0 11 
* * *', command:='VACUUM',database:=current_database(), username:='CaseOwner');
+
+SET SESSION AUTHORIZATION caseowner;
+SELECT cron.unschedule(8);
+RESET SESSION AUTHORIZATION;
+
 -- Override function
 DROP EXTENSION IF EXISTS pg_cron cascade;
 CREATE TABLE test (data text);
@@ -168,5 +183,7 @@
 -- cleaning
 DROP EXTENSION pg_cron;
 drop user pgcron_cront;
+drop user "CaseOwner";
+drop user caseowner;
 drop database pgcron_dbno;
 drop database pgcron_dbyes;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pg_cron-1.6.7/src/job_metadata.c 
new/pg_cron-1.6.8/src/job_metadata.c
--- old/pg_cron-1.6.7/src/job_metadata.c        2025-09-04 12:17:08.000000000 
+0200
+++ new/pg_cron-1.6.8/src/job_metadata.c        2026-09-08 16:16:13.000000000 
+0200
@@ -491,6 +491,12 @@
 
        if (PG_ARGISNULL(0))
                ereport(ERROR, (errmsg("job_name can not be NULL")));
+       /*
+       * v1.4 changed the first argument type from "name" to "text". Cope with
+       * calls from "CREATE EXTENSION pg_cron VERSION '1.3'".
+       */
+       else if (get_fn_expr_argtype(fcinfo->flinfo, 0) == NAMEOID)
+               jobnameText = cstring_to_text(NameStr(*PG_GETARG_NAME(0)));
        else
                jobnameText = PG_GETARG_TEXT_P(0);
 
@@ -751,13 +757,13 @@
 
        /* check if the current user owns the row */
        Oid userId = GetUserId();
-       char *userName = GetUserNameFromId(userId, false);
 
        bool isNull = false;
        Datum ownerNameDatum = heap_getattr(heapTuple, Anum_cron_job_username,
                                                                                
tupleDescriptor, &isNull);
        char *ownerName = TextDatumGetCString(ownerNameDatum);
-       if (pg_strcasecmp(userName, ownerName) != 0)
+       Oid ownerId = get_role_oid(ownerName, true);
+       if (ownerId != userId)
        {
                /* otherwise, allow if the user has DELETE permission */
                AclResult aclResult = pg_class_aclcheck(CronJobRelationId(), 
GetUserId(),
@@ -821,6 +827,7 @@
 InvalidateJobCacheCallback(Datum argument, Oid relationId)
 {
        if (relationId == CachedCronJobRelationId ||
+               relationId == InvalidOid ||
                CachedCronJobRelationId == InvalidOid)
        {
                CronJobCacheValid = false;
@@ -948,6 +955,7 @@
        Datum userName = heap_getattr(heapTuple, Anum_cron_job_username,
                                                                  
tupleDescriptor, &isNull);
 
+       jobKey = DatumGetInt64(jobId);
        jobOwner = TextDatumGetCString(userName);
        jobOwnerId = get_role_oid(jobOwner, false);
        if (!EnableSuperuserJobs && superuser_arg(jobOwnerId))
@@ -959,12 +967,10 @@
                 */
                ereport(WARNING, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
                                                  errmsg("skipping job " 
INT64_FORMAT " since superuser jobs "
-                                                                "are currently 
disallowed",
-                                                                job->jobId)));
+                                                                "are currently 
disallowed", jobKey)));
                return NULL;
        }
 
-       jobKey = DatumGetInt64(jobId);
        job = hash_search(CronJobHash, &jobKey, HASH_ENTER, &isPresent);
 
        job->jobId = DatumGetInt64(jobId);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pg_cron-1.6.7/src/pg_cron.c 
new/pg_cron-1.6.8/src/pg_cron.c
--- old/pg_cron-1.6.7/src/pg_cron.c     2025-09-04 12:17:08.000000000 +0200
+++ new/pg_cron-1.6.8/src/pg_cron.c     2026-09-08 16:16:13.000000000 +0200
@@ -11,7 +11,19 @@
  *
  *-------------------------------------------------------------------------
  */
+
+/** move this first so windows gets the winsock early */
+#include "cron.h"
+
+#if defined(_WIN32) && (PG_VERSION_NUM < 160000)
+/*
+* Skip sys/resource.h for PG15 and lower on Windows
+* this is only an issue with PG < 16 for windows cause of the changes in 16 
and above for windows
+*/
+#else
 #include <sys/resource.h>
+#endif
+
 
 #include "postgres.h"
 #include "fmgr.h"
@@ -19,6 +31,7 @@
 /* these are always necessary for a bgworker */
 #include "miscadmin.h"
 #include "postmaster/bgworker.h"
+#include "storage/fd.h"
 #include "storage/ipc.h"
 #include "storage/latch.h"
 #include "storage/lwlock.h"
@@ -30,7 +43,6 @@
 /* these headers are used by this particular worker's code */
 
 #define MAIN_PROGRAM
-#include "cron.h"
 
 #include "pg_cron.h"
 #include "task_states.h"
@@ -43,6 +55,13 @@
 #include <sys/poll.h>
 #endif
 
+#if defined(_WIN32)
+#include <windows.h>
+#include <winsock2.h>
+
+#define poll WSAPoll
+#endif
+
 #include "sys/time.h"
 #include "time.h"
 
@@ -72,6 +91,11 @@
 #include "mb/pg_wchar.h"
 #include "parser/analyze.h"
 #include "pgstat.h"
+#if PG_VERSION_NUM >= 130000
+#include "postmaster/interrupt.h"
+#else
+#define SignalHandlerForConfigReload PostgresSigHupHandler
+#endif
 #include "postmaster/postmaster.h"
 #include "utils/builtins.h"
 #include "utils/fmgroids.h"
@@ -120,8 +144,6 @@
 /* forward declarations */
 void _PG_init(void);
 void _PG_fini(void);
-static  void pg_cron_sigterm(SIGNAL_ARGS);
-static void pg_cron_sighup(SIGNAL_ARGS);
 PGDLLEXPORT void PgCronLauncherMain(Datum arg);
 PGDLLEXPORT void CronBackgroundWorker(Datum arg);
 
@@ -149,15 +171,13 @@
 static bool jobStartupTimeout(CronTask *task, TimestampTz currentTime);
 static char* pg_cron_cmdTuples(char *msg);
 static void bgw_generate_returned_message(StringInfoData *display_msg, 
ErrorData edata);
+static void CleanupCronTask(CronTask *task);
 
 /* global settings */
 char *CronTableDatabaseName = "postgres";
 static bool CronLogStatement = true;
 static bool CronLogRun = true;
-static bool CronReloadConfig = false;
-
-/* flags set by signal handlers */
-static volatile sig_atomic_t got_sigterm = false;
+static bool CronDomDowAndLogic = false;
 
 /* global variables */
 static int CronTaskStartTimeout = 10000; /* maximum connection time */
@@ -170,7 +190,10 @@
 
 static char  *cron_timezone = NULL;
 
-static const struct config_enum_entry cron_message_level_options[] = {
+#if PG_VERSION_NUM < 190000
+#define PG_SIG_IGN SIG_IGN
+
+static const struct config_enum_entry server_message_level_options[] = {
        {"debug5", DEBUG5, false},
        {"debug4", DEBUG4, false},
        {"debug3", DEBUG3, false},
@@ -186,6 +209,7 @@
        {"panic", PANIC, false},
        {NULL, 0, false}
 };
+#endif
 
 static const char *cron_error_severity(int elevel);
 
@@ -195,7 +219,7 @@
 void
 _PG_init(void)
 {
-       BackgroundWorker worker;
+       BackgroundWorker worker = {0,};
 
        if (IsBinaryUpgrade)
        {
@@ -313,7 +337,7 @@
                NULL,
                &CronLogMinMessages,
                WARNING,
-               cron_message_level_options,
+               server_message_level_options,
                PGC_SIGHUP,
                GUC_SUPERUSER_ONLY,
                NULL, NULL, NULL);
@@ -328,6 +352,16 @@
                GUC_SUPERUSER_ONLY,
                check_timezone, NULL, NULL);
 
+       DefineCustomBoolVariable(
+               "cron.match_dom_and_dow",
+               gettext_noop("Requires a day to match both the day-of-month and 
day-of-week fields."),
+               NULL,
+               &CronDomDowAndLogic,
+               false,
+               PGC_SIGHUP,
+               GUC_SUPERUSER_ONLY,
+               NULL, NULL, NULL);
+
        /* set up common data for all our workers */
        worker.bgw_flags = BGWORKER_SHMEM_ACCESS | 
BGWORKER_BACKEND_DATABASE_CONNECTION;
        worker.bgw_start_time = BgWorkerStart_RecoveryFinished;
@@ -349,39 +383,6 @@
 
 
 /*
- * Signal handler for SIGTERM
- *             Set a flag to let the main loop to terminate, and set our latch 
to wake
- *             it up.
- */
-static void
-pg_cron_sigterm(SIGNAL_ARGS)
-{
-       got_sigterm = true;
-
-       if (MyProc != NULL)
-       {
-               SetLatch(&MyProc->procLatch);
-       }
-}
-
-
-/*
- * Signal handler for SIGHUP
- *             Set a flag to tell the main loop to reload the cron jobs.
- */
-static void
-pg_cron_sighup(SIGNAL_ARGS)
-{
-       CronJobCacheValid = false;
-       CronReloadConfig = true;
-
-       if (MyProc != NULL)
-       {
-               SetLatch(&MyProc->procLatch);
-       }
-}
-
-/*
  * pg_cron_cmdTuples -
  *      mainly copy/pasted from PQcmdTuples
  *      If the last command was INSERT/UPDATE/DELETE/MOVE/FETCH/COPY, return
@@ -492,17 +493,18 @@
        return elevel_char;
 }
 
+#if PG_VERSION_NUM < 150000
 /*
- * bgw_generate_returned_message -
- *      generates the message to be inserted into the job_run_details table
- *      first part is comming from error_severity (elog.c)
+ * error_severity --- get string representing elevel
+ *
+ * copied from elog.c
  */
-static void
-bgw_generate_returned_message(StringInfoData *display_msg, ErrorData edata)
+static const char *
+error_severity(int elevel)
 {
        const char *prefix;
 
-       switch (edata.elevel)
+       switch (elevel)
        {
                case DEBUG1:
                case DEBUG2:
@@ -512,7 +514,7 @@
                        prefix = gettext_noop("DEBUG");
                        break;
                case LOG:
-#if (PG_VERSION_NUM >= 100000)
+#if PG_VERSION_NUM >= 100000
                case LOG_SERVER_ONLY:
 #endif
                        prefix = gettext_noop("LOG");
@@ -524,6 +526,9 @@
                        prefix = gettext_noop("NOTICE");
                        break;
                case WARNING:
+#if PG_VERSION_NUM >= 140000
+               case WARNING_CLIENT_ONLY:
+#endif
                        prefix = gettext_noop("WARNING");
                        break;
                case ERROR:
@@ -540,6 +545,20 @@
                        break;
        }
 
+       return prefix;
+}
+#endif
+
+/*
+ * bgw_generate_returned_message -
+ *      generates the message to be inserted into the job_run_details table
+ *      first part is comming from error_severity (elog.c)
+ */
+static void
+bgw_generate_returned_message(StringInfoData *display_msg, ErrorData edata)
+{
+       const char *prefix = error_severity(edata.elevel);
+
        appendStringInfo(display_msg, "%s: %s", prefix, edata.message);
        if (edata.detail != NULL)
                appendStringInfo(display_msg, "\nDETAIL: %s", edata.detail);
@@ -560,12 +579,17 @@
 PgCronLauncherMain(Datum arg)
 {
        MemoryContext CronLoopContext = NULL;
+
+       #if defined(_WIN32)
+       uint32 maxIoFiles;
+       #else
        struct rlimit limit;
+       #endif
 
        /* Establish signal handlers before unblocking signals. */
-       pqsignal(SIGHUP, pg_cron_sighup);
-       pqsignal(SIGINT, SIG_IGN);
-       pqsignal(SIGTERM, pg_cron_sigterm);
+       pqsignal(SIGHUP, SignalHandlerForConfigReload);
+       pqsignal(SIGINT, PG_SIG_IGN);
+       pqsignal(SIGTERM, die);
 
        /* We're now ready to receive signals */
        BackgroundWorkerUnblockSignals();
@@ -597,11 +621,19 @@
                MaxRunningTasks = max_files_per_process;
        }
 
-       if (getrlimit(RLIMIT_NOFILE, &limit) != 0 &&
+
+    #if defined(_WIN32)
+    maxIoFiles = (uint32)_getmaxstdio();
+       if (maxIoFiles != 0 && maxIoFiles < (uint32)MaxRunningTasks) {
+               MaxRunningTasks = maxIoFiles;
+       }
+       #else
+       if (getrlimit(RLIMIT_NOFILE, &limit) == 0 &&
                limit.rlim_cur < (uint32) MaxRunningTasks)
        {
                MaxRunningTasks = limit.rlim_cur;
        }
+       #endif
 
        if (UseBackgroundWorkers && max_worker_processes - 1 < MaxRunningTasks)
        {
@@ -630,7 +662,7 @@
 
        MemoryContextSwitchTo(CronLoopContext);
 
-       while (!got_sigterm)
+       for (;;)
        {
                List *taskList = NIL;
                TimestampTz currentTime = 0;
@@ -639,20 +671,18 @@
 
                AcceptInvalidationMessages();
 
-               if (CronReloadConfig)
+               if (ConfigReloadPending)
                {
                        /* set the desired log_min_messages */
                        ProcessConfigFile(PGC_SIGHUP);
                        SetConfigOption("log_min_messages", 
cron_error_severity(CronLogMinMessages),
                                                                                
                PGC_POSTMASTER, PGC_S_OVERRIDE);
-                       CronReloadConfig = false;
+                       ConfigReloadPending = false;
+
+                       /* Some settings might have changed, force 
RefreshTaskHash() */
+                       CronJobCacheValid = false;
                }
 
-               /*
-                * Both CronReloadConfig and CronJobCacheValid are triggered by 
SIGHUP.
-                * ProcessConfigFile should come first, because RefreshTaskHash 
depends
-                * on settings that might have changed.
-                */
                if (!CronJobCacheValid)
                {
                        RefreshTaskHash();
@@ -669,10 +699,7 @@
                MemoryContextReset(CronLoopContext);
        }
 
-       ereport(LOG, (errmsg("pg_cron scheduler shutting down")));
-
-       /* return error code to trigger restart */
-       proc_exit(1);
+       /* Not reachable */
 }
 
 
@@ -991,7 +1018,7 @@
        if (bit_test(schedule->minute, minute) &&
                bit_test(schedule->hour, hour) &&
                bit_test(schedule->month, month) &&
-               ((schedule->flags & (DOM_STAR | DOW_STAR)) != 0
+               ((CronDomDowAndLogic || (schedule->flags & (DOM_STAR | 
DOW_STAR)) != 0)
                         ? (thisdom && thisdow)
                         : (thisdom || thisdow)))
        {
@@ -1520,8 +1547,7 @@
 
                        if (!registered)
                        {
-                               dsm_detach(task->seg);
-                               task->seg = NULL;
+                               CleanupCronTask(task);
                                task->state = CRON_TASK_ERROR;
                                task->errorMessage = "could not start 
background process; more "
                                                                         
"details may be available in the server log";
@@ -1537,8 +1563,7 @@
                        status = WaitForBackgroundWorkerStartup(&task->handle, 
&pid);
                        if (status != BGWH_STARTED && status != BGWH_STOPPED)
                        {
-                               dsm_detach(task->seg);
-                               task->seg = NULL;
+                               CleanupCronTask(task);
                                task->state = CRON_TASK_ERROR;
                                task->errorMessage = "could not start 
background process; more "
                                                                         
"details may be available in the server log";
@@ -1548,7 +1573,7 @@
                        task->lastStartTime = GetCurrentTimestamp();
 
                        if (CronLogRun)
-                               UpdateJobRunDetail(task->runId, &pid, 
GetCronStatus(CRON_STATUS_RUNNING), NULL, &task->lastStartTime, NULL);
+                               UpdateJobRunDetail(task->runId, (int32 *) &pid, 
GetCronStatus(CRON_STATUS_RUNNING), NULL, &task->lastStartTime, NULL);
 
                        task->state = CRON_TASK_BGW_RUNNING;
                        break;
@@ -1596,7 +1621,7 @@
 
                                pid = (pid_t) PQbackendPID(connection);
                                if (CronLogRun)
-                                       UpdateJobRunDetail(task->runId, &pid, 
GetCronStatus(CRON_STATUS_SENDING), NULL, NULL, NULL);
+                                       UpdateJobRunDetail(task->runId, (int32 
*) &pid, GetCronStatus(CRON_STATUS_SENDING), NULL, NULL, NULL);
                        }
                        else if (pollingStatus == PGRES_POLLING_FAILED)
                        {
@@ -1736,8 +1761,7 @@
                        {
                                TerminateBackgroundWorker(&task->handle);
                                WaitForBackgroundWorkerShutdown(&task->handle);
-                               dsm_detach(task->seg);
-                               task->seg = NULL;
+                               CleanupCronTask(task);
 
                                break;
                        }
@@ -1759,9 +1783,7 @@
 
                                task->state = CRON_TASK_DONE;
 
-                               dsm_detach(task->seg);
-
-                               task->seg = NULL;
+                               CleanupCronTask(task);
                                RunningTaskCount--;
                        }
 
@@ -1838,6 +1860,25 @@
        }
 }
 
+static void
+CleanupCronTask(CronTask *task)
+{
+       if (task == NULL)
+               return;
+
+       if (task->sharedMemoryQueue != NULL)
+       {
+               shm_mq_detach(task->sharedMemoryQueue);
+               task->sharedMemoryQueue = NULL;
+       }
+
+       if (task->seg != NULL)
+       {
+               dsm_detach(task->seg);
+               task->seg = NULL;
+       }
+}
+
 static void
 GetTaskFeedback(PGresult *result, CronTask *task)
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pg_cron-1.6.7/src/task_states.c 
new/pg_cron-1.6.8/src/task_states.c
--- old/pg_cron-1.6.7/src/task_states.c 2025-09-04 12:17:08.000000000 +0200
+++ new/pg_cron-1.6.8/src/task_states.c 2026-09-08 16:16:13.000000000 +0200
@@ -156,6 +156,8 @@
        task->isActive = true;
        task->errorMessage = NULL;
        task->freeErrorMessage = false;
+       task->seg = NULL;
+       task->sharedMemoryQueue = NULL;
 }
 
 

Reply via email to