diff --git a/tests/sqllogictests/suites/query/functions/02_0012_function_datetimes_tz.test b/tests/sqllogictests/suites/query/functions/02_0012_function_datetimes_tz.test index e9a4e05f081d..6871d4ec4a2e 100644 --- a/tests/sqllogictests/suites/query/functions/02_0012_function_datetimes_tz.test +++ b/tests/sqllogictests/suites/query/functions/02_0012_function_datetimes_tz.test @@ -882,11 +882,16 @@ SELECT substr(DATE_ADD(month, 1, now())::String, 11)=substr(now()::String, 11); # format: 11 query T -SELECT substr(DATE_ADD(month, 1, now())::String, 6, 2) = -CASE - WHEN substr(now()::String, 6, 2) = '12' THEN '01' - ELSE LPAD((substr(now()::String, 6, 2)::int + 1)::String, 2, '0') -END; +SELECT + substr(DATE_ADD(month, 1, now())::String, 6, 2)= + CASE + WHEN substr(now()::String, 6, 2) = '12' THEN '01' + ELSE + IF(length((substr(now()::String, 6, 2)::int + 1)::String) = 1, + LPAD((substr(now()::String, 6, 2)::int + 1)::String, 2, '0'), + (substr(now()::String, 6, 2)::int + 1)::String + ) + END; ---- 1 diff --git a/tests/sqllogictests/suites/query/functions/02_0075_function_datetimes_tz.test b/tests/sqllogictests/suites/query/functions/02_0075_function_datetimes_tz.test index ecb8eddb1279..91eadbd33ba1 100644 --- a/tests/sqllogictests/suites/query/functions/02_0075_function_datetimes_tz.test +++ b/tests/sqllogictests/suites/query/functions/02_0075_function_datetimes_tz.test @@ -756,11 +756,16 @@ SELECT substr(DATE_ADD(month, 1, now())::String, 11)=substr(now()::String, 11); # format: 11 query T -SELECT substr(DATE_ADD(month, 1, now())::String, 6, 2) = -CASE - WHEN substr(now()::String, 6, 2) = '12' THEN '01' - ELSE LPAD((substr(now()::String, 6, 2)::int + 1)::String, 2, '0') -END; +SELECT + substr(DATE_ADD(month, 1, now())::String, 6, 2)= + CASE + WHEN substr(now()::String, 6, 2) = '12' THEN '01' + ELSE + IF(length((substr(now()::String, 6, 2)::int + 1)::String) = 1, + LPAD((substr(now()::String, 6, 2)::int + 1)::String, 2, '0'), + (substr(now()::String, 6, 2)::int + 1)::String + ) + END; ---- 1