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

Add Type_handler::Key_part_spec_init_ft

    XMLWordPrintable

Details

    Description

      This code in sql_table.cc is not friendly to data type plugins:

            if ((sql_field->real_field_type() != MYSQL_TYPE_STRING &&
                 sql_field->real_field_type() != MYSQL_TYPE_VARCHAR &&
                 !f_is_blob(sql_field->pack_flag)) ||
                sql_field->charset == &my_charset_bin ||
                sql_field->charset->mbminlen > 1 || // ucs2 doesn't work yet
                (ft_key_charset && sql_field->charset != ft_key_charset))
            {
                my_error(ER_BAD_FT_COLUMN, MYF(0), column->field_name.str);
                DBUG_RETURN(-1);
            }
            ft_key_charset=sql_field->charset;
            /*
              for fulltext keys keyseg length is 1 for blobs (it's ignored in ft
              code anyway, and 0 (set to column width later) for char's. it has
              to be correct col width for char's, as char data are not prefixed
              with length (unlike blobs, where ft code takes data length from a
              data prefix, ignoring column->length).
            */
             column->length= MY_TEST(f_is_blob(sql_field->pack_flag));
      

      New data types will reuse the same type codes. For example, INET6 will report itself as MYSQL_TYPE_STRING while it won't support fulltext.

      Let's add a new method in Type_handler:

      virtual bool Key_part_spec_init_ft(Key_part_spec *part,
                                         const Column_definition &def) const;
      

      and split this code into virtual implementations for specific Type_handler_xxx implementations.

      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.