Re: error: insert has more expressions than target column

Поиск
Список
Период
Сортировка
От Björn Lundin
Тема Re: error: insert has more expressions than target column
Дата
Msg-id chl4q8$13c6$1@news.hub.org
обсуждение исходный текст
Ответ на Re: error: insert has more expressions than target column  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
Dino Vliet wrote:

> MUCH better now....I did manage to get an insert into
> the table lessons with these adjustments...BUT now it
> seems the FOR LOOP didn't work because I only get 1
> record and expected that I would get 8 records due to
> the i variabele.
>
> What could be wrong?
>
> My code is now:
>
> CREATE FUNCTION vulalles() RETURNS trigger AS '
> BEGIN
> FOR i in 0..7 LOOP
> INSERT INTO lessons (......)
> SELECT dayofweek,startdate + (i*7), enddate +
> (i*7),...;
> RETURN NEW;
> END LOOP;
> END;
> ' LANGUAGE plpgsql;

Is the 'RETURN NEW' statement supposed to be _BEFORE_ end loop?
To me, it looks like you are returning from the function
in the first loop turn.
/Njörn

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

Предыдущее
От: "Katsaros Kwn/nos"
Дата:
Сообщение: stringToNode() for plan nodes...
Следующее
От: Dennis Gearon
Дата:
Сообщение: Release of 8.0.0