Made diff aggregate work in GPDB by adding a merge function
Minor changes