未验证 提交 a0bd9771 编写于 作者: S Serge Rider 提交者: GitHub

Merge pull request #13319 from dbeaver/#11917

#11917 take into account that we can rename newly created object
......@@ -453,8 +453,22 @@ public abstract class SQLObjectEditor<OBJECT_TYPE extends DBSObject, CONTAINER_T
@Override
public DBECommand<?> merge(DBECommand<?> prevCommand, Map<Object, Object> userParams) {
// We need to dismiss all rename commands if there is a create command in the command queue.
// Otherwise we issue redundant rename commands
// See https://github.com/dbeaver/dbeaver/issues/11917
int hashCode = getObject().hashCode();
String createId = "create#" + hashCode;
Object createCmd = userParams.get(createId);
if (createCmd != null) {
return (DBECommand<?>) createCmd;
}
if (prevCommand instanceof SQLObjectEditor.ObjectCreateCommand) {
userParams.put(createId, prevCommand);
return prevCommand;
}
// We need very first and very last rename commands. They produce final rename
final String mergeId = "rename" + getObject().hashCode();
String mergeId = "rename#" + hashCode;
ObjectRenameCommand renameCmd = (ObjectRenameCommand) userParams.get(mergeId);
if (renameCmd == null) {
renameCmd = new ObjectRenameCommand(getObject(), getTitle(), options, newName);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册