PL/SQL parser (MDEV-10142)

[MDEV-10579] sql_mode=ORACLE: Triggers: Understand :NEW.c1 and :OLD.c1 instead of NEW.c1 and OLD.c1 Created: 2016-08-17  Updated: 2020-08-27  Resolved: 2016-08-25

Status: Closed
Project: MariaDB Server
Component/s: Parser, Stored routines
Affects Version/s: None
Fix Version/s: 10.3.0

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

Sprint: 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18

 Description   

When running in sql_mode=ORACLE, MariaDB should understand :NEW and :OLD as references to new and old row values in addition or instead of NEW and OLD without colon.

DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, c INT);
DROP TRIGGER tr1;
CREATE TRIGGER tr1 BEFORE INSERT ON t1
FOR EACH ROW
DECLARE
  cnt INT := 0;
BEGIN
  IF :NEW.a IS NULL THEN cnt:=cnt+1; END IF;
  IF :NEW.b IS NULL THEN cnt:=cnt+1; END IF;
  IF :NEW.c IS NULL THEN :NEW.c:=cnt; END IF;
END;
/


Generated at Thu Feb 08 07:43:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.