On Tue, 2018-11-13 at 13:44 +0100, Jürgen Strobel wrote: > On 2018-11-13 00:57, Tom Lane wrote: > > =?UTF-8?Q?J=c3=bcrgen_Strobel?= <juergen+postgre...@strobel.info> > > writes: > > > On 2018-11-12 17:33, Tom Lane wrote: > > > > I'm not entirely convinced that I buy that argument, especially > > > > not in > > > > a case like this where it introduces logical inconsistencies > > > > where there > > > > otherwise wouldn't be any. > > > I think I missed something, what are the *introduced* logical > > > problems? > > > > What to do if a partition introduces a default value that would > > force > > re-routing to some other partition. > > I would claim this is a problem which already exists with the current > behavior: >
I think the question is what part of the current behavior is intentional (albeit with corner-cases not handled or rejected properly), and what part is just not thought through. Not sure. > a) If a tuple is inserted through the parent it's ignored and > useless. > b) If a tuple is inserted through the partition it can lead to > inconsistency and a constraint violation (possibly rectifiable by a > re-route which I think we all agree is out of the question). > Yeah, allowing defaults mismatching the partition seems like a can of worms. We certainly should not allow such rows to be inserted in the partition. Routing them somewhere else seems tricky, so perhaps it'd be better to just error-out in this case. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services