PL/SQL parser - Phase 2 (MDEV-10764)

[MDEV-15664] sql_mode=ORACLE: Make TRIM return NULL instead of empty string Created: 2018-03-26  Updated: 2018-03-30  Resolved: 2018-03-30

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.3
Fix Version/s: 10.3.6

Type: Technical task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-15739 sql_mode=ORACLE: Make LPAD and RPLAD ... Closed

 Description   

Earlier we made concatenation operator and SUBSTR translate empty results to NULL when running with sql_mode=ORACLE.

Under terms of this task we'll change TRIM, LTRIM, RTRIM to do the same.

The below scripts demonstrate Oracle's behavior:

SELECT
  CASE
    WHEN TRIM('a' FROM 'aa') IS NULL THEN 'IS NULL'
    ELSE 'IS NOT NULL'
  END AS c
FROM DUAL;

C
-----------
IS NULL

SELECT
  CASE
    WHEN LTRIM('  ') IS NULL THEN 'IS NULL'
    ELSE 'IS NOT NULL'
  END AS c
FROM DUAL;

C
-----------
IS NULL

SELECT
  CASE
    WHEN RTRIM('  ') IS NULL THEN 'IS NULL'
    ELSE 'IS NOT NULL'
  END AS c
FROM DUAL;

C
-----------
IS NULL


Generated at Thu Feb 08 08:23:05 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.