diff --git a/source/dbconnection.pas b/source/dbconnection.pas index 0dfd3cec..7818bd67 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -5589,11 +5589,21 @@ begin // Inexact fallback detection, wrong if MariaDB allows "0+1" as expression at some point Result := Result or Value.IsEmpty or IsInt(Value[1]); end else if FParameters.IsAnyMySQL then begin - // Only MySQL case with expression in default value is as follows: - if (Tp.Category = dtcTemporal) and Value.StartsWith('CURRENT_TIMESTAMP', True) then begin - Result := False; - end else begin - Result := True; + if ServerVersionInt <= 80013 then begin + // Only MySQL case with expression in default value is as follows: + if (Tp.Category = dtcTemporal) and Value.StartsWith('CURRENT_TIMESTAMP', True) then begin + Result := False; + end else begin + Result := True; + end; + end + else begin + // https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html#data-type-defaults-explicit + // MySQL 8.0.13+ expect expressions to be wrapped in (..) when you create a table. + // But checking if first char is an opening parenthesis does not work here, as we get the expression + // from IS.COLUMNS, not from SHOW CREATE TABLE. So here's a workaround for distinguishing text + // from an expression: + Result := not Value.Contains('('); end; end else begin // MS SQL, PG and SQLite: