commit 16c7244e4eebca4f3ee2cd84e0bd4241bda39532
Author: Alexander Barkov <bar@mariadb.com>
Date:   Mon Jan 22 16:53:54 2024 +0400

    MDEV-27666 User variable not parsed as geometry variable in geometry function
    
    Adding a test that a 10.4 slave understands a 10.5.24 binary log with a POINT
    user varible.
    
    This test proves that:
    
    - The 10.5->10.4 replication does not break
    
    - The extra data type name chunk, indicated by the new 10.5
      User_var_log_event chunk code CHUNK_DATA_TYPE_NAME==2,
      is just ignored by 10.4, so a POINT user variable is seen
      as a LONGBLOB user variable. Hence, a 10.4 slave creates a LONGBLOB
      column instead of a POINT column. This is how a pre-MDEV-27666 version
      worked.
      After merging of this patch to 10.5, the SHOW CREATE TABLE statement
      in the test output is expected to report a POINT column rather than
      a LONGBLOB column.

diff --git a/mysql-test/std_data/rpl/mariadb-bin-10.5.24-geom-user-var.000001 b/mysql-test/std_data/rpl/mariadb-bin-10.5.24-geom-user-var.000001
new file mode 100644
index 00000000000..b6643fbddbf
Binary files /dev/null and b/mysql-test/std_data/rpl/mariadb-bin-10.5.24-geom-user-var.000001 differ
diff --git a/mysql-test/suite/rpl/r/rpl_10_5_24_stm_user_var_geom.result b/mysql-test/suite/rpl/r/rpl_10_5_24_stm_user_var_geom.result
new file mode 100644
index 00000000000..0471985ef32
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_10_5_24_stm_user_var_geom.result
@@ -0,0 +1,27 @@
+#
+# MDEV-27666 User variable not parsed as geometry variable in geometry function
+#
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
+connection master;
+include/rpl_stop_server.inc [server_number=1]
+include/rpl_start_server.inc [server_number=1]
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+include/start_slave.inc
+connection master;
+connection slave;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `p` longblob DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT AsText(p) FROM t1 ORDER BY p;
+AsText(p)
+POINT(0 0)
+POINT(1 1)
+include/stop_slave.inc
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_10_5_24_stm_user_var_geom.test b/mysql-test/suite/rpl/t/rpl_10_5_24_stm_user_var_geom.test
new file mode 100644
index 00000000000..a2f76d730ab
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_10_5_24_stm_user_var_geom.test
@@ -0,0 +1,57 @@
+--source include/have_binlog_format_statement.inc
+
+--echo #
+--echo # MDEV-27666 User variable not parsed as geometry variable in geometry function
+--echo #
+
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--connection slave
+--source include/stop_slave.inc
+
+--connection master
+--let $datadir= `SELECT @@datadir`
+
+--let $rpl_server_number= 1
+--source include/rpl_stop_server.inc
+
+--remove_file $datadir/master-bin.000001
+
+#
+# Simulate a MariaDB-10.5.24 master
+#
+# mariadb-bin-10.5.24-geom-user-var.000001 was recorded against this script:
+#
+# using this command line:
+#   mariadbd --log-bin --binlog-format=statement \
+#            --server-id=1 --character-set-server=latin1
+# with the following SQL script:
+#
+#SET @p=POINT(0,0);
+#CREATE TABLE t1 AS SELECT @p AS p;
+#INSERT INTO t1 VALUES (POINT(1,1));
+
+--copy_file $MYSQL_TEST_DIR/std_data/rpl/mariadb-bin-10.5.24-geom-user-var.000001 $datadir/master-bin.000001
+
+--let $rpl_server_number= 1
+--source include/rpl_start_server.inc
+
+--source include/wait_until_connected_again.inc
+
+--connection slave
+--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
+eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+
+--source include/start_slave.inc
+
+--connection master
+--sync_slave_with_master
+SHOW CREATE TABLE t1;
+SELECT AsText(p) FROM t1 ORDER BY p;
+
+--source include/stop_slave.inc
+DROP TABLE t1;
+
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
