[MDEV-19727] Add Type_handler::Key_part_spec_init_ft Created: 2019-06-11  Updated: 2019-06-11  Resolved: 2019-06-11

Status: Closed
Project: MariaDB Server
Component/s: Data types
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

 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.


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