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

Add Field::tmp_engine_column_type()

    XMLWordPrintable

Details

    Description

      There are two similar pieces of the code not friendly to user defined plugins in

      • opt_subselect.cc:

           if (field->flags & BLOB_FLAG)
             recinfo->type= FIELD_BLOB;
           else if (use_packed_rows &&
                    field->real_type() == MYSQL_TYPE_STRING &&
                   length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
             recinfo->type=FIELD_SKIP_ENDSPACE;
           else
             recinfo->type=FIELD_NORMAL;
        

      • sql_select.cc:

           if (field->flags & BLOB_FLAG)
             recinfo->type= FIELD_BLOB;
           else if (use_packed_rows &&
                    field->real_type() == MYSQL_TYPE_STRING &&
                   length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
             recinfo->type= FIELD_SKIP_ENDSPACE;
           else if (field->real_type() == MYSQL_TYPE_VARCHAR)
             recinfo->type= FIELD_VARCHAR;
           else
             recinfo->type= FIELD_NORMAL;
        

      We'll split this code into a new virtual method in Field:

      virtual en_fieldtype tmp_engine_column_type(bool use_packed_rows) const;
      

      so user data types will be able to redefine behaviour as they wish.

      Note, originally these two pieces were equal, but then the sql_select.cc version was later extended to handle MYSQL_TYPE_VARCHAR in a special way.
      According to SergeP, these two pieces were indended to be equal. So there is probably a bug in the opt_subselect.cc version. This change will fix this problem.

      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.