Skip site navigation (1) Skip section navigation (2)

pga_next_schedule function bug

From: "Glen Sasek" <sasekg(at)gmail(dot)com>
To: <pgadmin-hackers(at)postgresql(dot)org>
Subject: pga_next_schedule function bug
Date: 2005-12-22 23:24:16
Message-ID: 006901c6074e$d76d5cf0$c5bcfc83@PSU.DS.PDX.EDU (view raw or flat)
Thread:
Lists: pgadmin-hackers
When creating a schedule or running the test code in pgagent.sql  the 
following occurs:
ERROR: syntax error at or near "IF"
CONTEXT: compile of PL/pgSQL function "pga_next_schedule" near line 161
PL/pgSQL function "pga_job_trigger" line 4 at select into variables
PL/pgSQL function "pga_schedule_trigger" line 10 at SQL statement

This can be fixed by editing the pga_next_schedule function around lines 
131-163; the problem is that there is no ELSEIF keyword in the language. The 
correct syntax is ELSIF.

Here's a corrected version of the block of code that is causing problems:
        -- Was the last day flag selected?
        IF nextday = 32 THEN
            IF nextmonth = 1 THEN
                nextday := 31;
            ELSIF nextmonth = 2 THEN
                IF pgagent.pga_is_leap_year(nextyear) = TRUE THEN
                    nextday := 29;
                ELSE
                    nextday := 28;
                END IF;
            ELSIF nextmonth = 3 THEN
                nextday := 31;
            ELSIF nextmonth = 4 THEN
                nextday := 30;
            ELSIF nextmonth = 5 THEN
                nextday := 31;
            ELSIF nextmonth = 6 THEN
                nextday := 30;
            ELSIF nextmonth = 7 THEN
                nextday := 31;
            ELSIF nextmonth = 8 THEN
                nextday := 31;
            ELSIF nextmonth = 9 THEN
                nextday := 30;
            ELSIF nextmonth = 10 THEN
                nextday := 31;
            ELSIF nextmonth = 11 THEN
                nextday := 30;
            ELSIF nextmonth = 12 THEN
                nextday := 31;
            ELSE
                --do nothing
            END IF;
        END IF; 


pgadmin-hackers by date

Next:From: Andrew DunstanDate: 2005-12-22 23:49:17
Subject: Re: [pgadmin-hackers] Client-side password encryption
Previous:From: Dave PageDate: 2005-12-21 17:19:13
Subject: Re: Out of luck (building from source on OS X)???

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group