You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unexpected result when using LTRIM with NULL as second argument #15527
Consider the test case below. It is unexpected that the second query returns TRUE, because there's one NULL value in the function argument. Still, if it is expected, the third query should return NULL, as the result of the WHERE predicate is TRUE.
RTRIM also shares the same issue. Have tested #15498 on this version and it worked as expected.
Steps to Reproduce
DROPTABLE IF EXISTS t1;
CREATETABLEt1(c1 INT);
INSERT INTO t1 (c1) VALUES (null);
REFRESH TABLE t1;
SELECTt1.c1FROM t1; -- NULLSELECT LTRIM(11, t1.c1)!=1FROM t1; -- TRUE (unexpected?)SELECTt1.c1FROM t1 WHERE ((LTRIM(11, t1.c1))!=1);
-- Expected (if second query is expected): NULL-- Actual: empty result
Actual Result
As mentioned above
Expected Result
The second query should return NULL, otherwise the thrid query should return NULL
Activity
jeeminso commentedon Feb 8, 2024
Thanks for reporting @suyZhong. As you mentioned, I think the bug here may be
ltrim:since we try to achieve Postgres compatibility if possible.
Fixed TRIM/LTRIM/RTRIM/BTRIM on null 2nd arg
Fixed TRIM/LTRIM/RTRIM/BTRIM on null 2nd arg
Fixed TRIM/LTRIM/RTRIM/BTRIM on null 2nd arg
Fixed TRIM/LTRIM/RTRIM/BTRIM on null 2nd arg
Fixed TRIM/LTRIM/RTRIM/BTRIM on null 2nd arg
Fixed TRIM/LTRIM/RTRIM/BTRIM on null 2nd arg
matriv commentedon Feb 8, 2024
Thx for reporting @suyZhong ! The issue has been fixed and will be available with the next hotfix release.
Fixed TRIM/LTRIM/RTRIM/BTRIM on null 2nd arg