This commit moves a lot of test setup logic to runner.sh. Also
passes the right commands to the regression infrastructure to create
appropriate users and run tests as a regular user.
With standard PostgreSQL append plans, planning-time constraint
exclusion does not work if a query expression contains restrictions
that are non-constants (e.g., mutable functions like now()). This
leads to full scans of all chunks (child tables), significantly
increasing query time.
To fix this, we wrap append plans (Append and MergeAppend) in a
ConstraintAwareAppend plan, which excludes child relations at
execution time by pruning the child relations from the regular append
plan. This happens after first constifying the original restriction
clause every time the plan is executed.
This optimization only happens if there are non-constant restrictions
in the original query and the entire optimization can be disbled with
a GUC variable.