pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Protasov Vladimir <eoranged@yandex.com>
To: pgsql-sql@postgresql.org
Subject: INSERT/UPDATE .. RETURNING
Date: Wed, 12 Jan 2011 15:41:13 +0300
Message-ID: <606041294836076@web120.yandex.ru> (raw)

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.



Message-ID: <606041294836076@web120.yandex.ru>
Permalink:  ../606041294836076@web120.yandex.ru/
Also on:    postgresql.org/message-id/606041294836076@web120.yandex.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: eoranged@yandex.com
  Subject: Re: INSERT/UPDATE .. RETURNING
  In-Reply-To: <606041294836076@web120.yandex.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox