Details
-
Bug
-
Status: In Review (View Workflow)
-
Critical
-
Resolution: Unresolved
-
13.0
-
None
-
Q2/2026 Server Maintenance
Description
If the field value is NULL, the UPDATE ... RETURNING statement returns the old value as an empty string instead of NULL
13.0.0-dbg>create or replace table t1(a varchar(10)); |
Query OK, 0 rows affected (0.022 sec) |
|
|
13.0.0-dbg>insert into t1 values(); |
Query OK, 1 row affected (0.002 sec)
|
|
|
13.0.0-dbg>select * from t1; |
+------+ |
| a |
|
+------+ |
| NULL | |
+------+ |
1 row in set (0.000 sec) |
|
|
13.0.0-dbg>update t1 set a = 'a' returning old_value(a) as old, a as new; |
+------+------+ |
| old | new |
|
+------+------+ |
| | a |
|
+------+------+ |
1 row in set (0.003 sec) |
|
|
13.0.0-dbg>
|
when we set the field value to NULL, both old and new values return as NULL
13.0.0-dbg>create or replace table t1(a varchar(10)); |
Query OK, 0 rows affected (0.021 sec) |
|
|
13.0.0-dbg>insert into t1 values(''); |
Query OK, 1 row affected (0.002 sec)
|
|
|
13.0.0-dbg>select * from t1; |
+------+ |
| a |
|
+------+ |
| |
|
+------+ |
1 row in set (0.001 sec) |
|
|
13.0.0-dbg>update t1 set a=NULL returning old_value(a) as old, a as new; |
+------+------+ |
| old | new |
|
+------+------+ |
| NULL | NULL | |
+------+------+ |
1 row in set (0.002 sec) |
|
|
13.0.0-dbg>
|
Attachments
Issue Links
- is caused by
-
MDEV-5092 Implement UPDATE with result set (UPDATE ... RETURNING)
-
- In Testing
-