#12128 Quote special floating-point values

上级 fe6d20e2
......@@ -816,6 +816,12 @@ public class PostgreDialect extends JDBCSQLDialect implements TPRuleProvider {
// For now we use workaround: represent objects as strings
return '\'' + escapeString(strValue) + '\'';
}
if ((value instanceof Float && (((Float) value).isNaN() || ((Float) value).isInfinite()))
|| (value instanceof Double && (((Double) value).isNaN() || ((Double) value).isInfinite()))) {
// PostgreSQL doesn't like special values such as NaN and +-Infinity without quotes
// https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL
return '\'' + String.valueOf(value) + '\'';
}
return super.escapeScriptValue(attribute, value, strValue);
}
......
......@@ -636,9 +636,6 @@ public final class SQLUtils {
} else {
strValue = valueHandler.getValueDisplayString(attribute, value, displayFormat);
}
if (value instanceof Number) {
return strValue;
}
SQLDialect sqlDialect = dataSource.getSQLDialect();
DBPDataKind dataKind = attribute.getDataKind();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册