[MDEV-30562] Add support for anchored data types for user variables Created: 2023-02-03  Updated: 2023-11-30

Status: Open
Project: MariaDB Server
Component/s: Stored routines
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Valerii Kravchuk Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

We have anchored data types declarations support since 10.3.3 and MDEV-14139. But while this kind of use for them works:

MariaDB [test]> delimiter //
MariaDB [test]> create procedure prt(OUT a row type of mysql.user) begin select *
into a from mysql.user limit 1; end;//
Query OK, 0 rows affected (0.156 sec)
 
MariaDB [test]> create procedure use_prt() begin declare b row type of mysql.user; call prt(b); select b.user, b.host; end;//
Query OK, 0 rows affected (0.192 sec)
 
MariaDB [test]> call use_prt()//
+-------------+-----------+
| b.user      | b.host    |
+-------------+-----------+
| mariadb.sys | localhost |
+-------------+-----------+
1 row in set (0.012 sec)
 
Query OK, 1 row affected (0.012 sec)

we have no way to return to a user variable:

MariaDB [test]> call prt(@a)//
ERROR 1241 (21000): Operand should contain 1 column(s)

and this makes a feature incomplete and even misleading. It would make sense to let user variables be of record types and rely on anchored types declarations, both for compatibility and consistency.


Generated at Thu Feb 08 10:17:11 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.