On 6/4/18 16:50, Tom Lane wrote: > Perhaps, but I'm having a hard time wrapping my mind around what the > semantics ought to be. If a trigger on partition A changes the keys > so that the row shouldn't have gone into A at all, what then? That > trigger should never have fired, eh?
The insert will result in an error and everything is rolled back, so you do kind of get the "should never have" behavior. It seems we ultimately have to answer the question whether we want BEFORE triggers executed before or after tuple routing. Both behaviors might be useful, so perhaps we'll need two kinds of triggers. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services