Skip to content

feature: add support unsigned syntax on tianmu engine #1013

@hustjieke

Description

@hustjieke

Is your feature request related to a problem? Please describe.

mysql> create table t1( a int unsigned zerofill, b int) engine = innodb;
Query OK, 0 rows affected (0.03 sec)

mysql> create table t2( a int unsigned zerofill, b int) engine = tianmu;
ERROR 6 (HY000): UNSIGNED data types are not supported.

Describe the solution you'd like

Remove UNSIGNED_FLAG check in Engine::GetAttrTypeInfo():

  switch (field.type()) {
    case MYSQL_TYPE_SHORT:
    case MYSQL_TYPE_TINY:
    case MYSQL_TYPE_INT24:
    case MYSQL_TYPE_LONG:
    case MYSQL_TYPE_FLOAT:
    case MYSQL_TYPE_DOUBLE:
    case MYSQL_TYPE_LONGLONG:
      if (field.flags & UNSIGNED_FLAG)
        throw common::UnsupportedDataTypeException("UNSIGNED data types are not supported.");
      [[fallthrough]];

Describe alternatives you've considered

Additional context

Note:

As of MySQL 8.0.17, the UNSIGNED attribute is deprecated for columns of type [FLOAT](https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html), [DOUBLE](https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html), and [DECIMAL](https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html) (and any synonyms); you should expect support for it to be removed in a future version of MySQL. Consider using a simple CHECK constraint instead for such columns.

The result depends on the SQL mode in effect at the time, see:
Out-of-Range and Overflow Handling
https://dev.mysql.com/doc/refman/8.0/en/out-of-range-and-overflow.html

Required Storage and Range for Integer Types Supported by MySQL:
https://dev.mysql.com/doc/refman/8.0/en/integer-types.html

Metadata

Metadata

Assignees

Labels

A-featurefeature with good ideaC-stonedb-5.7associated with stonedb 5.7C-stonedb-8.0associated with stonedb 8.0

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions