[MDEV-19724] Add Field::tmp_engine_column_type() Created: 2019-06-10  Updated: 2019-06-10  Resolved: 2019-06-10

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   

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.


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