Re: [Maria-developers] a507f126b03: MDEV-29159 Patch for MDEV-28918 introduces more inconsistency than it solves, breaks usability
Hi, Alexander, a thought about the error message text and a couple of questions about changes in results, please, see below: On Aug 05, Alexander Barkov wrote:
revision-id: a507f126b03 (mariadb-10.7.4-39-ga507f126b03) parent(s): 97d16c7544c author: Alexander Barkov committer: Alexander Barkov timestamp: 2022-08-05 09:42:46 +0400 message:
MDEV-29159 Patch for MDEV-28918 introduces more inconsistency than it solves, breaks usability
1. Store assignment failures on incompatible data types now cause errors if: - STRICT_ALL_TABLES or STRICT_TRANS_TABLES sql_mode is used, and - IGNORE is not used
Otherwise, only a warning is raised and the statement continues.
2. Changing the error/warning test as follows:
-ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +ERROR HY000: Unknown CAST(int AS inet6) in assignment of 'target'
Better not to write 'CAST(int AS inet6)' if there's no explicit CAST() function, I think it might be confusing. I'd say Cannot cast int as inet6 in assignment of 'target'
so in case of a big table it's easier to see which column has the problem. The new error text is aslo applied to SP variables.
s/aslo/also/
diff --git a/mysql-test/main/sp-vars.result b/mysql-test/main/sp-vars.result index 127a0993e2b..feef67ccb1d 100644 --- a/mysql-test/main/sp-vars.result +++ b/mysql-test/main/sp-vars.result @@ -1026,11 +1026,11 @@ BEGIN SELECT arg; END| CALL p1((1, 2)); -ERROR HY000: Illegal parameter data types tinyint and row for operation 'SET' +ERROR 21000: Operand should contain 1 column(s)
Why not "Unknown CAST" like elsewhere?
diff --git a/mysql-test/main/type_geometry_mix_int.result b/mysql-test/main/type_geometry_mix_int.result index e5d00c63727..0d0a21a8d29 100644 --- a/mysql-test/main/type_geometry_mix_int.result +++ b/mysql-test/main/type_geometry_mix_int.result @@ -6,6 +6,7 @@ # CREATE TABLE t1 (target GEOMETRY DEFAULT POINT(1,1), source INT DEFAULT 0); # Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= (SELECT @@sql_mode);
strange, why not `SET @sql_mode_save= @@sql_mode` ?
SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME='source' AND TABLE_NAME='t1' @@ -47,6 +52,7 @@ INSERT INTO t3 VALUES (2, (SELECT source FROM t2 ORDER BY id LIMIT 1), (SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
What's that? It wasn't an error, and now it is?
SELECT * FROM v3; id target source 1 POINT(1 1) 0
Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org
Hi, Alexander,
-ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +ERROR HY000: Unknown CAST(int AS inet6) in assignment of 'target'
sorry, forgot to add, let's also add a db/table name here? and use the proper backtick quoting for identifiers Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org
Hello Sergei, Please find a new patch here: https://github.com/MariaDB/server/commit/3ebbfd88a0360938e3a5a480265beb2a71b... See comments below: On 8/5/22 5:27 PM, Sergei Golubchik wrote:
Hi, Alexander,
a thought about the error message text and a couple of questions about changes in results, please, see below:
<cut>
2. Changing the error/warning test as follows:
-ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +ERROR HY000: Unknown CAST(int AS inet6) in assignment of 'target'
Better not to write 'CAST(int AS inet6)' if there's no explicit CAST() function, I think it might be confusing. I'd say
Cannot cast int as inet6 in assignment of 'target'
Done. Also added db/table names, as you suggested in the next email.
so in case of a big table it's easier to see which column has the problem. The new error text is aslo applied to SP variables.
s/aslo/also/
Fixed.
diff --git a/mysql-test/main/sp-vars.result b/mysql-test/main/sp-vars.result index 127a0993e2b..feef67ccb1d 100644 --- a/mysql-test/main/sp-vars.result +++ b/mysql-test/main/sp-vars.result @@ -1026,11 +1026,11 @@ BEGIN SELECT arg; END| CALL p1((1, 2)); -ERROR HY000: Illegal parameter data types tinyint and row for operation 'SET' +ERROR 21000: Operand should contain 1 column(s)
Why not "Unknown CAST" like elsewhere?
This test uses non-strict sql_mode. The data type compatibility test now issues a warning instead of an error in non-strict modes. So the warning about data types gets later overridden by the "... 1 column(s)" error.
diff --git a/mysql-test/main/type_geometry_mix_int.result b/mysql-test/main/type_geometry_mix_int.result index e5d00c63727..0d0a21a8d29 100644 --- a/mysql-test/main/type_geometry_mix_int.result +++ b/mysql-test/main/type_geometry_mix_int.result @@ -6,6 +6,7 @@ # CREATE TABLE t1 (target GEOMETRY DEFAULT POINT(1,1), source INT DEFAULT 0); # Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= (SELECT @@sql_mode);
strange, why not `SET @sql_mode_save= @@sql_mode` ?
Fixed.
SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME='source' AND TABLE_NAME='t1' @@ -47,6 +52,7 @@ INSERT INTO t3 VALUES (2, (SELECT source FROM t2 ORDER BY id LIMIT 1), (SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
What's that? It wasn't an error, and now it is?
The error was there, but it was not displayed. In the patch I removed --error 0,ER_CANT_CREATE_GEOMETRY_OBJECT and added this command instead: --disable_abort_on_error Looks like a bug in mysqltest, it displays nothing in case of this command: -- 0, ER_XXX1, ER_XXX2 even if an error happened.
SELECT * FROM v3; id target source 1 POINT(1 1) 0
Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org
participants (2)
-
Alexander Barkov
-
Sergei Golubchik