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