public String getTargetType(DBPDataSource targetDataSource) {
    if (!CommonUtils.isEmpty(targetType)) {
      return targetType;
    }
    // TODO: make some smart data type matcher
    // Current solution looks like hack
    String typeName = source.getTypeName();
    DBPDataKind dataKind = source.getDataKind();
    if (targetDataSource instanceof DBPDataTypeProvider) {
      DBPDataTypeProvider dataTypeProvider = (DBPDataTypeProvider) targetDataSource;
      DBSDataType dataType = dataTypeProvider.getLocalDataType(typeName);
      if (dataType == null && typeName.equals("DOUBLE")) {
        dataType = dataTypeProvider.getLocalDataType("DOUBLE PRECISION");
        if (dataType != null) {
          typeName = dataType.getTypeName();
        }
      }
      if (dataType != null && dataType.getDataKind() != dataKind) {
        // Type mismatch
        dataType = null;
      }
      if (dataType == null) {
        // Type not supported by target database
        // Let's try to find something similar
        List<DBSDataType> possibleTypes = new ArrayList<>();
        for (DBSDataType type : dataTypeProvider.getLocalDataTypes()) {
          if (type.getDataKind() == dataKind) {
            possibleTypes.add(type);
          }
        }
        typeName = DBUtils.getDefaultDataTypeName(targetDataSource, dataKind);
        if (!possibleTypes.isEmpty()) {
          DBSDataType targetType = null;
          for (DBSDataType type : possibleTypes) {
            if (type.getName().equalsIgnoreCase(typeName)) {
              targetType = type;
              break;
            }
          }
          if (targetType == null) {
            targetType = possibleTypes.get(0);
          }
          typeName = targetType.getTypeName();
        }
      }
      if (dataType != null) {
        dataKind = dataType.getDataKind();
      }
    }

    String modifiers = SQLUtils.getColumnTypeModifiers(source, typeName, dataKind);
    if (modifiers != null) {
      typeName += modifiers;
    }
    return typeName;
  }
 @Override
 public void appendModifier(
     OBJECT_TYPE column, StringBuilder sql, DBECommandAbstract<OBJECT_TYPE> command) {
   final String typeName = column.getTypeName();
   DBPDataKind dataKind = column.getDataKind();
   final DBSDataType dataType = findDataType(column.getDataSource(), typeName);
   sql.append(' ').append(typeName);
   if (dataType == null) {
     log.debug(
         "Type name '"
             + typeName
             + "' is not supported by driver"); //$NON-NLS-1$ //$NON-NLS-2$
   } else {
     dataKind = dataType.getDataKind();
   }
   String modifiers = SQLUtils.getColumnTypeModifiers(column, typeName, dataKind);
   if (modifiers != null) {
     sql.append(modifiers);
   }
 }
  @Override
  protected String[] resolveAll(final TemplateContext context) {
    final DBCExecutionContext executionContext =
        ((DBPContextProvider) context).getExecutionContext();
    if (executionContext == null) {
      return super.resolveAll(context);
    }

    DBPDataTypeProvider dataTypeProvider =
        DBUtils.getAdapter(DBPDataTypeProvider.class, executionContext.getDataSource());
    if (dataTypeProvider != null) {
      final Collection<? extends DBSDataType> localDataTypes = dataTypeProvider.getLocalDataTypes();
      if (!CommonUtils.isEmpty(localDataTypes)) {
        String[] result = new String[localDataTypes.size()];
        int index = 0;
        for (DBSDataType dataType : localDataTypes) {
          result[index++] = dataType.getName();
        }
        return result;
      }
    }
    return super.resolveAll(context);
  }