mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Issue #1800: attempt to distinguish text values from function expressions in a column's default value, for MySQL 8.0.13+ which seems to allow just all functions as default value.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user