[MDEV-26845] For unsupported statements ROW_NUMBER shows different values depending on previous events Created: 2021-10-15  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.7
Fix Version/s: 10.11

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Rucha Deodhar
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-10075 Provide index of error causing error ... Closed

 Description   

--source include/have_innodb.inc
--disable_abort_on_error
 
create or replace table t (a tinyint) engine=InnoDB;
backup stage end;
get diagnostics condition 1 @n1 = row_number;
insert into t values (1),(2),(1000);
backup stage end;
get diagnostics condition 1 @n2 = row_number;
select 1;
backup stage end;
get diagnostics condition 1 @n3 = row_number;
select @n1, @n2, @n3;

bb-10.7-row_number cb9002bee36

MariaDB [test]> select @n1, @n2, @n3;
+------+------+------+
| @n1  | @n2  | @n3  |
+------+------+------+
|    0 |    3 |    1 |
+------+------+------+
1 row in set (0.000 sec)

It should probably be always 0.

Same applies to various other statements, e.g. the same test case returns the same result if backup stage end is replaced by a failing drop database, or grant, etc.



 Comments   
Comment by Elena Stepanova [ 2021-10-15 ]

Also applies to at least some ALTER TABLEs, e.g.

alter table t add key(a(0));

I give up on trying to make the summary accurate, please adjust it as needed after analysis.

Comment by Elena Stepanova [ 2021-10-15 ]

Given the variety of affected statements, I'm raising it to Major, but since apparently it concerns (mainly?) statements which are out of the scope of MDEV-10075, I'm keeping it off 10.7 "must do" list.

Comment by Elena Stepanova [ 2021-10-18 ]

Somewhat more obvious case

SELECT 1 INTO OUTFILE 'f';
SELECT COUNT(*) FROM information_schema.tables;
--error ER_FILE_EXISTS_ERROR
SELECT 1 INTO OUTFILE 'f';
GET DIAGNOSTICS CONDITION 1 @n = ROW_NUMBER, @m = MESSAGE_TEXT;
SELECT @n, @m;

bb-10.7-row_number c27f04ede

COUNT(*)
265
SELECT 1 INTO OUTFILE 'f';
ERROR HY000: File 'f' already exists
GET DIAGNOSTICS CONDITION 1 @n = ROW_NUMBER, @m = MESSAGE_TEXT;
SELECT @n, @m;
@n	@m
266	File 'f' already exists

Generated at Thu Feb 08 09:48:24 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.