I'm not sure what "not unique to statements" in this context means, but anyway, indeed there are certainly error messages universal enough so that a row number doesn't make sense in all (or even most) cases. Here is one example, it's rather artificial, which is in itself proves the point.
MariaDB [test]> create table t1 (a int);
|
Query OK, 0 rows affected (0.026 sec)
|
|
MariaDB [test]> create trigger tr after insert on t1 for each row select * into outfile 'f1' from t1;
|
Query OK, 0 rows affected (0.017 sec)
|
|
MariaDB [test]> insert into t1 values (1),(2);
|
ERROR 1086 (HY000): File 'f1' already exists
|
MariaDB [test]> get diagnostics condition 1 @n=error_index; select @n;
|
Query OK, 0 rows affected (0.001 sec)
|
|
+------+
|
| @n |
|
+------+
|
| 2 |
|
+------+
|
1 row in set (0.000 sec)
|
So, while for this specific weird usage a row number does make sense and extending the message to File 'f1' already exists for row 2 would look all right, of course in the majority of cases ER_FILE_EXISTS_ERROR happens on a higher level and row numbers are meaningless there.
I guess choosing which error messages can be extended with row numbers requires some tedious research of how the messages are used. In my opinion it's still worth doing, but probably it's well outside the scope of MDEV-10075, so it's okay with me if you close it or detach it from 10.7 preview activities.
Discussed on slack with serg that ERROR_INDEX could most probably work for other statements but not sure which error messages can be used safely because there are some error messages that are not unique to statements.