Re: PL/pgSQL "compilation error"

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: PL/pgSQL "compilation error"
Дата
Msg-id 200103141533.KAA26366@candle.pha.pa.us
обсуждение исходный текст
Ответ на PL/pgSQL "compilation error"  (Tim Perdue <tim@perdue.net>)
Список pgsql-sql
>       IF NEW.status_id <> OLD.status_id THEN
>          IF new.status_id = 1 THEN
>             UPDATE artifact_counts_agg SET open_count=open_count+1 \
>                WHERE group_artifact_id=new.group_artifact_id;
>          ELSE IF new.status_id = 2 THEN
>             UPDATE artifact_counts_agg SET open_count=open_count-1 \
>                WHERE group_artifact_id=new.group_artifact_id;
>          ELSE IF new.status_id = 3 THEN
>             UPDATE artifact_counts_agg SET open_count=open_count-1,count=count-1 \
>                WHERE group_artifact_id=new.group_artifact_id;
>          END IF;
>       END IF; 
>    END IF;
>    RETURN NEW;

It is hard to test this without the table schema, but I think you are
missing some END IF's in the code above.  Those are not elif's, but
actual new IF's that need their own END IF, I think.


--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


В списке pgsql-sql по дате отправления:

Предыдущее
От: Tim Perdue
Дата:
Сообщение: Re: PL/pgSQL "compilation error"
Следующее
От: "Richard Huxton"
Дата:
Сообщение: Re: