INSERT/UPDATE .. RETURNING

From: Protasov Vladimir <eoranged(at)yandex(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: INSERT/UPDATE .. RETURNING
Date: 2011-01-12 12:41:13
Message-ID: 606041294836076@web120.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello everybody,
I have the table (named for example "mytable") and trigger on insert. The trigger do the following (in real trigger the logic is 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 with one: returning clause will not be invoked if insert returns nothing. But i really need return value for the insert.
Any ideas?

--
Regards,
Vladimir Protasov.

Browse pgsql-sql by date

  From Date Subject
Next Message George Francis 2011-01-12 22:30:25 joining one record according to max value
Previous Message - 2011-01-12 09:14:17 Implement PostgreSQL full text search