diff options
author | unknown <evgen@moonbone.local> | 2005-08-05 00:34:42 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2005-08-05 00:34:42 +0400 |
commit | c5bcb9f01c459e43e0c19e14b2910bea4af26393 (patch) | |
tree | ea443ade0b265ff4d840c6bc185eb459f3a51c95 /sql/item_sum.cc | |
parent | 2b41471429d9db41d64bfb214e29ba57cb3db381 (diff) | |
parent | a292b42436e476de109c2ffce6a3b469d738ca44 (diff) | |
download | mariadb-git-c5bcb9f01c459e43e0c19e14b2910bea4af26393.tar.gz |
Manual merge of #11335 bugfix
sql/item_sum.cc:
Auto merged
mysql-test/r/view.result:
Manual merge
mysql-test/t/view.test:
Manual megre
sql/sql_select.cc:
Manual merge
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index b669a8c426d..bbcea4705fa 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -321,6 +321,22 @@ Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table, field->flags&= ~NOT_NULL_FLAG; return field; } + /* + DATE/TIME fields have STRING_RESULT result types. + In order to preserve field type, it's needed to handle DATE/TIME + fields creations separately. + */ + switch (args[0]->field_type()) { + case MYSQL_TYPE_DATE: + return new Field_date(maybe_null, name, table, collation.collation); + case MYSQL_TYPE_TIME: + return new Field_time(maybe_null, name, table, collation.collation); + case MYSQL_TYPE_TIMESTAMP: + case MYSQL_TYPE_DATETIME: + return new Field_datetime(maybe_null, name, table, collation.collation); + default: + break; + } return Item_sum::create_tmp_field(group, table, convert_blob_length); } |