Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-23290

Add overloading support in MariaDB_FUNCTION_PLUGIN

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Fix Version/s: 10.7
    • Component/s: Plugins
    • Labels:
      None

      Description

      Under terms of MDEV-20837 we added MariaDB_FUNCTION_PLUGIN.

      Every function plugin exports a Create_func object. This is the traditional way of defining functions in MySQL/MariaDB. But it has a disadvantage: it does not support function overloading.

      So two plugin authors cannot create functions with the same name but different signatures, e.g.

      SOME_FUNC(geometry);
      SOME_FUNC(inet6);
      

      Inside the server we already have Item_handled_func, which supports overloading through its Item_handled_func::Handler, and which is used by some functions:

      • Bit operators | & ^ << >> ~
      • bit_expr + INTERVAL
      • BIT_COUNT()
      • ADDTIME()
      • STR_TO_DATE()
      • CAST(expr AS CHAR)

      For example, ADDTIME() has the following overloads:

      ADDTIME(DATE or DATETIME or TIMESTAMP, any scalar type)
      ADDTIME(TIME, any scalar type)
      ADDTIME(Any string type, any scalar type)
      

      Let's expose this interface to function plugins, so a function plugin exports:

      • either a traditional style Create_func object (without overloading support)
      • or a handler for Item_handled_func (with overloading support)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              holyfoot Alexey Botchkov
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated: