← Back to team overview

maria-discuss team mailing list archive

Re: Since MariaDB 10.1 aggregate functions return different field type for columns with date values

 

Hi, Stefan!

On Jul 02, Stefan Langenmaier wrote:
> Hi all,
> 
> If I execute the following query on MariaDB 10.1 or later, the result
> contains a column with a datetime field type (MYSQL_TYPE_DATETIME):
> 
> SELECT MIN(NOW()) AS t
> 
> On older versions or any version of MySQL this column is a text type
> (MYSQL_TYPE_VAR_STRING).
> 
> https://dev.mysql.com/doc/dev/mysql-server/latest/field__types_8h.html
> 
> Is there a possibility to use the old behavior in newer version?

Not for the same query. You can use a CAST or e.g. CONCAT, it'll force
the column into a string type, for example:

  SELECT CONCAT(MIN(NOW()))

Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx


Follow ups

References