public inbox for [email protected]  
help / color / mirror / Atom feed
From: Mehmet Emin KARAKAŞ <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: PgAgent leap year problem
Date: Mon, 2 Mar 2020 14:56:30 +0300
Message-ID: <CANQrdXBzJNK+_tDgju_qTq-OuG7dKdqNZ6Xv=-n0-RoYM0PXhA@mail.gmail.com> (raw)

Hi,

Scheduled tasks set as the last day of February this year did not work. In
your schedule function have a small bug.  Leap year function get year
parameter, but your code is sending day as a parameter.  Fixing patch
attached in this mail.

Best Regards...

-- 
MEHMET EMİN KARAKAŞ
PostgreSQL DBA

Turksat Satellite Communication and Cable TV Operations
Konya Yolu 40. Km. 06839 Golbasi / ANKARA - TÜRKİYE
Tel     :  +90 312 615 32 73
Faks  :  +90 312 615 32 77


Attachments:

  [text/x-patch] pgagent_leap_year_problem.diff (976B, 3-pgagent_leap_year_problem.diff)
  download | inline diff:
diff --git a/sql/pgagent.sql b/sql/pgagent.sql
index 7eb42ba..7ff552b 100644
--- a/sql/pgagent.sql
+++ b/sql/pgagent.sql
@@ -476,7 +476,7 @@ BEGIN
             (jscmonthdays = ''{f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,t}'' AND
              ((date_part(''MONTH'', nextrun) IN (1,3,5,7,8,10,12) AND date_part(''DAY'', nextrun) = 31) OR
               (date_part(''MONTH'', nextrun) IN (4,6,9,11) AND date_part(''DAY'', nextrun) = 30) OR
-              (date_part(''MONTH'', nextrun) = 2 AND ((pgagent.pga_is_leap_year(date_part(''DAY'', nextrun)::int2) AND date_part(''DAY'', nextrun) = 29) OR date_part(''DAY'', nextrun) = 28))))) AND
+              (date_part(''MONTH'', nextrun) = 2 AND ((pgagent.pga_is_leap_year(date_part(''YEAR'', nextrun)::int2) AND date_part(''DAY'', nextrun) = 29) OR date_part(''DAY'', nextrun) = 28))))) AND
             (jscmonths = ''{f,f,f,f,f,f,f,f,f,f,f,f}'' OR jscmonths[date_part(''MONTH'', nextrun)] = TRUE)) THEN
 
 


view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: PgAgent leap year problem
  In-Reply-To: <CANQrdXBzJNK+_tDgju_qTq-OuG7dKdqNZ6Xv=-n0-RoYM0PXhA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox