Add the max_length constraint to the query