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:
Ansgar Becker
2015-04-02 10:10:26 +00:00
parent 4d694a511b
commit 413643f1a0

View File

@@ -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