From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Matthew Nuzum <cobalt(at)bearfruit(dot)org>, Postgres General List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: error on last line of function |
Date: | 2002-11-25 10:31:10 |
Message-ID: | 200211251031.10626.dev@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Saturday 23 Nov 2002 3:38 am, Matthew Nuzum wrote:
> NOTICE: plpgsql: ERROR during compile of delete_page near line 81
> ERROR: parse error at or near ";"
>
> Line 81 is the last line of the function and merely says: END;
Ah, plpgsql's error reporting. Not always the most useful guide, though I
don't think it's easily changed.
> DECLARE
> temp record;
> BEGIN
> IF old.page_type = ''f''
> THEN
> IF old.ftr_type = ''adf''
> THEN
> -- adf features store id in ftr_data
> SELECT INTO temp delete_adf(old.ftr_data);
> ELSE IF old.ftr_type = ''cal''
> THEN
> -- cal features do not store id in ftr_data
> -- get the id
> SELECT INTO temp * FROM ftr_cal_calendar
> WHERE accountid = old.accountid AND name = substr(old.path,2);
> SELECT INTO temp delete_cal(temp.calendarid);
> ELSE IF old.ftr_type = ''cyu''
> THEN
> -- cyu stores id in ftr_data
> SELECT INTO temp delete_cyu(old.ftr_data);
> ELSE IF old.ftr_type = ''fa2'' OR old.ftr_type = ''faq''
I think the problem is you're missing the "END IF" from all the intermediate
IFs. I don't think there actually is an "ELSEIF" structure, it's just an ELSE
followed by an IF, so the IF needs to be concluded as normal. From the
manual:
IF demo_row.sex = ''m'' THEN
pretty_sex := ''man'';
ELSE
IF demo_row.sex = ''f'' THEN
pretty_sex := ''woman'';
END IF;
END IF;
See if that helps you any. Of course there may be a typo somewhere else too.
I'd suggest reducing the function to a single IF and expanding one block at a
time to spot the problem.
--
Richard Huxton
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Boget | 2002-11-25 13:39:24 | Few questions |
Previous Message | Darko Prenosil | 2002-11-25 09:43:25 | Location of language .mo files or 'Zašto postgres ne govori Hrvatski' ??? |