protected String getNewColumnName(DBECommandContext context, TABLE_TYPE table) { for (int i = 1; ; i++) { final String name = DBObjectNameCaseTransformer.transformName(table.getDataSource(), "Column" + i); try { // check for existing columns boolean exists = table.getAttribute(VoidProgressMonitor.INSTANCE, name) != null; if (!exists) { // Check for new columns (they are present only within command context) for (DBPObject contextObject : context.getEditedObjects()) { if (contextObject instanceof JDBCTableColumn && ((JDBCTableColumn) contextObject).getTable() == table && name.equalsIgnoreCase(((JDBCTableColumn) contextObject).getName())) { exists = true; break; } } } if (!exists) { return name; } } catch (DBException e) { log.warn(e); return name; } } }