Bug 19370: Add helper function for order_by attribute generation