pgsql: Produce compiler errors if errno is referenced inside elog/erepo

2018-08-11 Thread Tom Lane
Produce compiler errors if errno is referenced inside elog/ereport calls. It's often unsafe to reference errno within an elog/ereport call, because there are a lot of sub-functions involved and they might not all preserve errno. (This is why we support the %m format spec: it works off a value of

pgsql: Distinguish printf-like functions that support %m from those tha

2018-08-11 Thread Tom Lane
Distinguish printf-like functions that support %m from those that don't. The elog/ereport family of functions certainly support the %m format spec, because they implement it "by hand". But elsewhere we have printf wrappers that might or might not allow it depending on whether the platform's

pgsql: Fix wrong order of operations in inheritance_planner.

2018-08-11 Thread Tom Lane
Fix wrong order of operations in inheritance_planner. When considering a partitioning parent rel, we should stop processing that subroot as soon as we've done adjust_appendrel_attrs and any securityQuals updates. The rest of this is unnecessary, and indeed adding duplicate subquery RTEs to the

pgsql: Fix wrong order of operations in inheritance_planner.

2018-08-11 Thread Tom Lane
Fix wrong order of operations in inheritance_planner. When considering a partitioning parent rel, we should stop processing that subroot as soon as we've done adjust_appendrel_attrs and any securityQuals updates. The rest of this is unnecessary, and indeed adding duplicate subquery RTEs to the