pg.ddx.io pgsql-docs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Doc bug (?) in rules vs triggers 2+ messages / 2 participants [nested] [flat]
* Doc bug (?) in rules vs triggers @ 2004-02-13 20:29 andrew@pillette.com 2004-02-15 21:43 ` Re: Doc bug (?) in rules vs triggers Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 2+ messages in thread From: andrew@pillette.com @ 2004-02-13 20:29 UTC (permalink / raw) To: pgsql-docs Chapter 13 of the documentation on Rules versus Triggers says in part "On the other hand a trigger that is fired on INSERT on a view can do the same as a rule, put the data somewhere else and suppress the insert in the view." However, it does not appear to be possible to set a trigger on a view, so this means something else. (I'd like to set a trigger on a view, because the replacement INSERT I wish to make is easier to write in PLPGSQL than plain SQL.) ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Doc bug (?) in rules vs triggers 2004-02-13 20:29 Doc bug (?) in rules vs triggers andrew@pillette.com @ 2004-02-15 21:43 ` Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2004-02-15 21:43 UTC (permalink / raw) To: andrew@pillette.com; +Cc: pgsql-docs andrew@pillette.com writes: > Chapter 13 of the documentation on Rules versus Triggers says in part > "On the other hand a trigger that is fired on INSERT on a view can do > the same as a rule, put the data somewhere else and suppress the > insert in the view." > However, it does not appear to be possible to set a trigger on a view, > so this means something else. I think it means "this documentation is out of date" :-(. Once long ago a view was a regular table with an ON SELECT rule, and so you could in fact put triggers to catch attempted inserts rather than relying on an ON INSERT rule. This was removed because it was too failure-prone --- people who had misdefined their triggers kept wondering where their data went, when it in fact went into the view table and could never be seen again because of the ON SELECT rule. By requiring an ON INSERT rule, we can mechanically check for failure to redirect the insert. I think there were some implementation considerations motivating that change, as well. regards, tom lane ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2004-02-15 21:43 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2004-02-13 20:29 Doc bug (?) in rules vs triggers andrew@pillette.com 2004-02-15 21:43 ` Tom Lane <tgl@sss.pgh.pa.us>
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