From: Tom Lane <tgl@sss.pgh.pa.us>
To: andrew@pillette.com
Cc: pgsql-docs@postgresql.org
Subject: Re: Doc bug (?) in rules vs triggers
Date: Sun, 15 Feb 2004 16:43:04 -0500
Message-ID: <10821.1076881384@sss.pgh.pa.us> (raw)
In-Reply-To: <200402132029.i1DKTWp01272@pillette.com>
References: <200402132029.i1DKTWp01272@pillette.com>
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
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-docs@postgresql.org
Cc: tgl@sss.pgh.pa.us, andrew@pillette.com
Subject: Re: Doc bug (?) in rules vs triggers
In-Reply-To: <10821.1076881384@sss.pgh.pa.us>
* 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