[MDEV-27666] User variable not parsed as geometry variable in geometry function Created: 2022-01-28  Updated: 2024-01-22  Resolved: 2024-01-16

Status: Closed
Project: MariaDB Server
Component/s: GIS, Server
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.5.24, 10.6.17, 10.11.7, 11.0.5, 11.1.4, 11.2.3, 11.3.2, 11.4.1

Type: Bug Priority: Critical
Reporter: Anel Husakovic Assignee: Alexander Barkov
Resolution: Fixed Votes: 1
Labels: None

Attachments: File 10.4-test.diff     File mariadb-bin-10.5.24-geom-user-var.000001    
Issue Links:
Blocks
blocks MDEV-26161 crash in Gis_point::calculate_haversine Stalled
Duplicate
is duplicated by MDEV-30461 Cannot use variables inside geometry ... Closed
Issue split
split to MDEV-33283 Binlog Checksum is Zeroed by Zlib if ... Closed
Relates
relates to MDEV-26506 Over-quoted JSON when combining JSON_... Closed

 Description   

Repeatable with

set @g=  point(1, 1); 
select ST_AsWKT(GeometryCollection(Point(44, 6), @g));
 
ERROR 1367 (22007) at line 1: Illegal non geometric '@`g`' value found during parsing

The same bug exists in MySQL 8.0 with slightly different error message (note braces).

ERROR 1367 (22007) at line 1: Illegal non geometric '(@`g`)' value found during parsing



 Comments   
Comment by Alexey Botchkov [ 2023-12-14 ]

https://github.com/MariaDB/server/commit/1b9561fde4436568e210f96837e8351227261af8

Comment by Alexander Barkov [ 2023-12-29 ]

Hello Alexey,

I propose instead of adding a new enum for variable data type, implement this in a more generic way using Type_handler.

Please review this version:
https://github.com/MariaDB/server/commit/7d71e9901bf171fbac0f95e290b5612beedea90f

Comment by Alexey Botchkov [ 2024-01-16 ]

ok to push.

Comment by Alexander Barkov [ 2024-01-22 ]

Verified that 10.5->10.4 replication of user variables does not break.
The 10.4 slave ignores the extra CHUNK_DATA_TYPE_NAME chunk in the User_var_log_event.

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