Patch from Josh from bug #44371 - support for OFFSET function, and various tweaks...