Updated patch against cvs update in case it makes applying easier.
One minor change:
. Added #include <limits.h> in tuplesort.h to pull in UINT_MAX (thanks to dpage for noticing this is necessary on OSX)