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

Add CAST(expr AS pluggable_type)

    XMLWordPrintable

Details

    Description

      User defined type plugins and new built-in types (implemented as always-built-in plugins) will want to do CAST.
      This task will add infrastructure for such casts.

      Let's add this branch into the cast_type grammar rules:

             | IDENT_sys
               {
                 const Type_handler *h;
                 if (!(h= Type_handler::handler_by_name_or_error($1)))
                   MYSQL_YYABORT;
                 $$.set(h);
                 Lex->charset= NULL;
               }
      

      Note, the GEOMETRY data types (which is as of time of writing 95% plugin compatible) does not support CAST for now. So for test purposes let's override the relevant method as follows:

      Item *
      Type_handler_geometry::create_typecast_item(THD *thd, Item *item,
                                                 const Type_cast_attributes &attr)
                                                 const
      {
        DBUG_EXECUTE_IF("emulate_geometry_create_typecast_item",
          return new (thd->mem_root) Item_func_geometry_from_text(thd, item);
        );
       
        return NULL;
      }
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.