Rewrite generated take() stored procedures to correctly consider order parameter