Re: The tuple structure of a not-yet-assigned record is indeterminate.

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: The tuple structure of a not-yet-assigned record is indeterminate.
Дата
Msg-id 49C6E1B6.8030702@postnewspapers.com.au
обсуждение исходный текст
Ответ на The tuple structure of a not-yet-assigned record is indeterminate.  (M L <novemberox@gmail.com>)
Ответы Re: The tuple structure of a not-yet-assigned record is indeterminate.  (M L <novemberox@gmail.com>)
Список pgsql-general
M L wrote:

> CREATE TRIGGER league AFTER insert ON t_leagues FOR STATEMENT EXECUTE
> PROCEDURE add_view();
>
> Then in psql I made an query and got error:
>
> league=#  INSERT INTO t_leagues (name) VALUES('3liga');
> ERROR:  record "new" is not assigned yet
> DETAIL:  The tuple structure of a not-yet-assigned record is indeterminate.
> CONTEXT:  PL/pgSQL function "add_view" line 4 at RAISE

`NEW' and `OLD' refer to the tuple operated on by this call of the
trigger. They're not valid for FOR EACH STATEMENT triggers, since the
statement might've added/modified/deleted zero or more than one tuple.

If you want to see the values of the tuples modified, use a FOR EACH ROW
trigger.

> Whats wrong, I supposed that id is not reserverd at the moment

That's not the case. Your trigger is being called *AFTER* the row is
inserted, so the ID must've been assigned. In any case, default
expressions (including those used to assign values from sequences) are
actually evaluated even before the BEFORE triggers are invoked.

--
Craig Ringer

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

Предыдущее
От: M L
Дата:
Сообщение: The tuple structure of a not-yet-assigned record is indeterminate.
Следующее
От: Greenhorn
Дата:
Сообщение: bash & postgres