Bug 1376922 Union query on a view returns wrong results

Qifan investigated this bug and found the problem in replacePivs().

Rather than forcing the parent's partitioning function on the child,
the fix takes the child's function and only replaces the PIVs in it.

Additional changes:

- The replacePivs() method used a ValueIdSet for the PIVs. This should
  be a list, since we use multiple PIVs often by position in the list.
- We don't need the code in replacePivs() that fixes predicates in scan
  nodes, since we call replacePivs() before calling preCodeGen() on the
  child and therefore the child node does not yet have predicates that
  refer to PIVs.
- We don't need to replace the partitioning expression anymore, since
  it does not refer to any PIVs and we leave the partitioning key
  predicates almost unchanged.
- Fixing a small, unrelated, thing: When sourcing in sqenv.sh twice,
  it reported an error message, due to a shell variable that didn't
  get initialized to an empty string (workstation environment only).

Change-Id: Id8a20c0d958d8ce13edd59849a1418d252b5691d
Merge "Bug 1376922 Union query on a view returns wrong results"