mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Check whether column can be null, for composing a CREATE TABLE statement. Otherwise, leave away DEFAULT clause. See http://www.heidisql.com/forum.php?t=18055
This commit is contained in:
@@ -2661,9 +2661,11 @@ begin
|
||||
if Cols.Col('IS_NULLABLE') = 'NO' then
|
||||
Result := Result + ' NOT';
|
||||
Result := Result + ' NULL';
|
||||
if Cols.IsNull('COLUMN_DEFAULT') then
|
||||
Result := Result + ' DEFAULT NULL'
|
||||
else begin
|
||||
if Cols.IsNull('COLUMN_DEFAULT') then begin
|
||||
// Check whether column can be null. Otherwise, leave away DEFAULT clause.
|
||||
if Cols.Col('IS_NULLABLE') <> 'NO' then
|
||||
Result := Result + ' DEFAULT NULL'
|
||||
end else begin
|
||||
Result := Result + ' DEFAULT ' + Cols.Col('COLUMN_DEFAULT');
|
||||
end;
|
||||
// The following is wrong syntax in PostgreSQL, but helps ParseTableStructure to find the comment
|
||||
|
||||
Reference in New Issue
Block a user