mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Check if all indexes have at least one column when creating or altering table to prevent creation of empty index. Fixes issue #3516.
This commit is contained in:
@@ -5111,6 +5111,10 @@ msgstr "Selected operations cannot be applied to a %s"
|
||||
msgid "Unhandled tree level"
|
||||
msgstr "Unhandled tree level"
|
||||
|
||||
#: table_editor.pas:380
|
||||
msgid "%s Index \"%s\" does not contain any column. You can add columns using drag''n drop from the columns list."
|
||||
msgstr "%s Index \"%s\" does not contain any column. You can add columns using drag''n drop from the columns list."
|
||||
|
||||
#: table_editor.pas:476
|
||||
msgid "Composing ALTER statement ..."
|
||||
msgstr "Composing ALTER statement ..."
|
||||
|
||||
@@ -373,8 +373,19 @@ var
|
||||
i: Integer;
|
||||
Rename: String;
|
||||
begin
|
||||
// Check if all indexes have at least one column
|
||||
// If not, exit early
|
||||
for i := 0 to FKeys.Count-1 do begin
|
||||
if FKeys.Items[i].Columns.Count = 0 then begin
|
||||
ErrorDialog( f_('%s Index "%s" does not contain any column. You can add columns using drag''n drop from the columns list.', [FKeys.Items[i].IndexType, FKeys.Items[i].Name]));
|
||||
Result := mrAbort;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
// Create or alter table
|
||||
Result := mrOk;
|
||||
|
||||
if DBObject.Name = '' then
|
||||
Batch := ComposeCreateStatement
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user