[MDEV-20016] Add MariaDB_DATA_TYPE_PLUGIN Created: 2019-07-10  Updated: 2020-03-13  Resolved: 2019-10-04

Status: Closed
Project: MariaDB Server
Component/s: Data types, Plugins
Fix Version/s: 10.5.0

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed
blocks MDEV-20841 Turn GIS implementation into a plugin Open
is blocked by MDEV-20052 Add a MEM_ROOT pointer argument to Ty... Closed
is blocked by MDEV-20721 Implement sql_type() for Field_real a... Closed
is blocked by MDEV-20734 Allow reserved keywords as user defin... Closed
Relates
relates to MDEV-4912 Data type plugin API version 1 Closed

 Description   

Let's add a new plugin type: MariaDB_DATA_TYPE_PLUGIN.

plugin->data of such plugin will point to a single Type_handler implementation. So looking up a pluggable data type by name should be done very easy, by this code block:

  if ((plugin= my_plugin_lock_by_name(thd, &name, MariaDB_DATA_TYPE_PLUGIN)))
  {
    /*
      INSTALL PLUGIN is not fully supported for data type plugins yet.
      Fow now we have only mandatory built-in plugins
      and dynamic plugins for test purposes,
      Should be safe to unlock the plugin immediately.
    */
    const Type_handler *ph= reinterpret_cast<const Type_handler*>
                            (plugin_ref_to_int(plugin)->data);
    plugin_unlock(thd, plugin);
    return ph;
  }

Note, as the above comment states, for now we assume we have:

  • mandatory built-in plugins
  • dynamic test plugins, used by MTR in a single-thread environment
    so locking (incrementing and decrementing use count) is out of scope of this task and will be done separately.

Under terms of this task let's implement a simple test plugin implementing an alias for an existing data type, to demonstrate that the plugin data type is understood in various contexts:

  • CREATE TABLE t1 (a XXX)
  • CAST(expr AS XXX)
  • CREATE FUNCTION f1() RETURNS XXX
  • DECLARE a XXX; – SP variable declarations


 Comments   
Comment by Alexander Barkov [ 2019-08-05 ]

serg, please review. The patch is here:
https://github.com/MariaDB/server/commit/3f38da9145cbb39b4fdc6fe31382ee7c8726aee5

Comment by Alexander Barkov [ 2019-09-17 ]

serg A new patch is here:

https://github.com/MariaDB/server/commit/17eeab8b470c237ce93d7ba9b5ecc6c4317d46e5

I.e. the top patch in this branch:
https://github.com/MariaDB/server/compare/bb-10.5-bar-m20016

Generated at Thu Feb 08 08:56:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.