Re: 8.2 RETURNING functionality in a trigger

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 8.2 RETURNING functionality in a trigger
Дата
Msg-id 12325.1183844802@sss.pgh.pa.us
обсуждение исходный текст
Ответ на 8.2 RETURNING functionality in a trigger  ("Doug Johnson" <metaphaze@gmail.com>)
Список pgsql-novice
"Doug Johnson" <metaphaze@gmail.com> writes:
> In psql I can run a query like this:
>     INSERT INTO foo(col1, col2, col3) VALUES (1, 2, 3) RETURNING col1;
> and I get col1 back from the insert.

> Now, when I do that in a C trigger via SPI_exec the SPI_exec succeeds, but I
> can't figure out how to access the RETURNING part.

Works for me; I suspect the problem is in some part of your code that
you didn't show us.  Is it really just a plain INSERT/RETURNING (no
possible interference from rules, say)?  Are you really only testing the
SPI_exec result code for negative (maybe you forgot to allow
SPI_OK_INSERT_RETURNING as a valid result)?

            regards, tom lane

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

Предыдущее
От: "Doug Johnson"
Дата:
Сообщение: 8.2 RETURNING functionality in a trigger
Следующее
От: Tjibbe
Дата:
Сообщение: REVOKE on ALTER USER, DROP USER