On Thu, Apr 2, 2015 at 5:02 PM, Andres Freund <and...@anarazel.de> wrote: >> I think the upshot is that INSTEAD OF triggers work in a particular way >> because that's what is needed to support updatable views. If triggers >> on tables should behave differently, maybe it should be a separate >> trigger type. Maybe it would be feasible to extend BEFORE triggers to >> support RETURNING, for example? > > What in the above prohibits extending the behaviour to tables? I have > yet to see what compatibility or similarity problem that'd pose. It > seems all mightily handwavy to me.
Yeah. It's possible there's a better interface here than INSTEAD OF, and one of the things I didn't like about the OP was that it started by stating the syntax that would be used rather than by describing the problem that needed to be solved. It's generally better to start with the latter, and then work out the syntax from there. But having gotten that gripe out of my system, and especially in view of Dean's comments, it's not very clear to me what's wrong with using INSTEAD OF for this purpose. If you make BEFORE triggers do this via RETURNING, then you might have a trigger that returns multiple rows, which seems like it would introduce a bunch of new complexity for no obvious benefit. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers