Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 95B961337B68 for ; Wed, 12 Jan 2011 08:51:21 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 91910-03 for ; Wed, 12 Jan 2011 12:51:14 +0000 (UTC) X-Greylist: delayed 00:09:31.605967 by SQLgrey-1.7.6 Received: from forward12.mail.yandex.net (forward12.mail.yandex.net [95.108.130.94]) by mail.postgresql.org (Postfix) with ESMTP id 0D3DA1337B64 for ; Wed, 12 Jan 2011 08:51:13 -0400 (AST) Received: from web120.yandex.ru (web120.yandex.ru [95.108.130.98]) by forward12.mail.yandex.net (Yandex) with ESMTP id BC2C62210F40 for ; Wed, 12 Jan 2011 15:41:18 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1294836078; bh=Ut3ZLGpgA0jWjCn5yB35qN25TKtCyx3ihdjU7/DWBPw=; h=From:To:Subject:MIME-Version:Message-Id:Date: Content-Transfer-Encoding:Content-Type; b=RJY8zS7iBSpsXujaeAU7kCe4wTrZKDfHih7CfQJ//X0uBwJT7r5Kuko2PPdU0to8f HtaCkjRxHiIkP7p2pNIKCnejRV3GaNI+zH2C2Rpxiq9s1am6CqMwAeH4Ign7VQf905 haafD3uts92gtQoAlq/YJgxNyVqi4PqsNJdNYRd4= Received: from localhost (localhost.localdomain [127.0.0.1]) by web120.yandex.ru (Yandex) with ESMTP id B3D4C58C8039 for ; Wed, 12 Jan 2011 15:41:18 +0300 (MSK) Received: from [91.213.144.3] ([91.213.144.3]) by mail.yandex.ru with HTTP; Wed, 12 Jan 2011 15:41:13 +0300 From: Protasov Vladimir To: pgsql-sql@postgresql.org Subject: INSERT/UPDATE .. RETURNING MIME-Version: 1.0 Message-Id: <606041294836076@web120.yandex.ru> Date: Wed, 12 Jan 2011 15:41:13 +0300 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.877 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FSL_RU_URL=2.271, SUBJ_ALL_CAPS=1.506 X-Spam-Level: * X-Archive-Number: 201101/32 X-Sequence-Number: 34979 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.