Re: insert/update/delete returning and rules

Поиск
Список
Период
Сортировка
Искать
От
Jens-Wolfhard Schicke
Тема
Re: insert/update/delete returning and rules
Дата
Msg-id
36B4DDEAF5A53F0D4C4F235F@[192.168.1.72]
Ответ на
Список
Дерево обсуждения
insert/update/delete returning and rules "Jaime Casanova" <systemguards@gmail.com>
Re: insert/update/delete returning and rules Tom Lane <tgl@sss.pgh.pa.us>
Re: insert/update/delete returning and rules "Jaime Casanova" <systemguards@gmail.com>
Re: insert/update/delete returning and rules Tom Lane <tgl@sss.pgh.pa.us>
Re: insert/update/delete returning and rules Jens-Wolfhard Schicke <j.schicke@asco.de>
Re: insert/update/delete returning and rules "Jonah H. Harris" <jonah.harris@gmail.com>
Re: insert/update/delete returning and rules "Jaime Casanova" <systemguards@gmail.com>
Re: insert/update/delete returning and rules Tom Lane <tgl@sss.pgh.pa.us>
Re: insert/update/delete returning and rules Tom Lane <tgl@sss.pgh.pa.us>
Re: insert/update/delete returning and rules "Zeugswetter Andreas DCP SD" <ZeugswetterA@spardat.at>
--On Dienstag, August 15, 2006 16:33:27 -0400 Tom Lane  
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		      j.schicke@asco.de
asco GmbH		      http://www.asco.de
Mittelweg 7		      Tel 0531/3906-127
38106 Braunschweig	      Fax 0531/3906-400

В списке pgsql-hackers по дате отправления
От: Arturo Pérez
Дата:
Сообщение: Re: An Idea for planner hints
От: Bruce Momjian
Дата:
Сообщение: Re: Enum proposal / design
FAQ