--On Dienstag, August 15, 2006 16:33:27 -0400 Tom Lane <[EMAIL PROTECTED]> wrote:
I'm tempted to suggest that the RETURNING commands might need to be
separate rule events, and that to support this you'd need to write
an additional rule:

        CREATE RULE r1 AS ON INSERT RETURNING TO myview DO INSTEAD
                INSERT ... RETURNING ...
...

But even this seems like it would fail in complicated cases.  What if
the view is a join, and your ON INSERT rule inserts into two different
underlying tables in two commands?  If you need fields from both tables
to generate a full RETURNING list then there's no apparent way to make
it work.

Ugh.  Any ideas out there?
CREATE RULE r1 AS ON INSERT RETURNING TO myview DO INSTEAD
   INSERT ... INTO tbl_1;
   INSERT ... INTO tbl_2;
   RETURNING SELECT .... FROM tbl_1, tbl_2 WHERE ...;

Just what crossed my mind first, no idea whether this is implementable or realistic or whatever.

Mit freundlichem Gruß
Jens Schicke
--
Jens Schicke                  [EMAIL PROTECTED]
asco GmbH                     http://www.asco.de
Mittelweg 7                   Tel 0531/3906-127
38106 Braunschweig            Fax 0531/3906-400

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to