Обсуждение: INSERT/UPDATE .. RETURNING

Поиск
Список
Период
Сортировка

INSERT/UPDATE .. RETURNING

От
Protasov Vladimir
Дата:
Hello everybody, 
I have the table (named for example "mytable") and trigger on insert. The trigger do the following (in real trigger the
logicis more complicated, but there is no difference for this question):
 
INSERT INTO another_table VALUES (NEW.*);
RETURN NULL;

And i want to do the following:
INSERT INTO "mytable" VALUES ('blah', 'blah', 'blah') RETURNING *;

But result is empty. I've tried to add rule on insert into "mytable" with returning clause, but there is the problem
withone: returning clause will not be invoked if insert returns nothing. But i really need return value for the
insert.
Any ideas?

-- 
Regards,
Vladimir Protasov.