diff --git a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlFullTextSearchMethodTranslator.cs b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlFullTextSearchMethodTranslator.cs index 51c8c0fbf..842461843 100644 --- a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlFullTextSearchMethodTranslator.cs +++ b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlFullTextSearchMethodTranslator.cs @@ -115,9 +115,8 @@ public SqlExpression Translate(SqlExpression instance, MethodInfo method, IReadO nameof(NpgsqlFullTextSearchLinqExtensions.And) => QueryReturningOnTwoQueries("&&"), nameof(NpgsqlFullTextSearchLinqExtensions.Or) => QueryReturningOnTwoQueries("||"), - // TODO: Hack, see #1118 nameof(NpgsqlFullTextSearchLinqExtensions.ToNegative) - => new SqlUnaryExpression(ExpressionType.Negate, arguments[0], arguments[0].Type, arguments[0].TypeMapping), + => new SqlUnaryExpression(ExpressionType.Not, arguments[0], arguments[0].Type, arguments[0].TypeMapping), nameof(NpgsqlFullTextSearchLinqExtensions.Contains) => BoolReturningOnTwoQueries("@>"), nameof(NpgsqlFullTextSearchLinqExtensions.IsContainedIn) => BoolReturningOnTwoQueries("<@"), diff --git a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlNetworkTranslator.cs b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlNetworkTranslator.cs index e4a6bfea7..efacb558f 100644 --- a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlNetworkTranslator.cs +++ b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlNetworkTranslator.cs @@ -69,8 +69,7 @@ public SqlExpression Translate(SqlExpression instance, MethodInfo method, IReadO nameof(NpgsqlNetworkExtensions.ContainsOrEqual) => BoolReturningOnTwoNetworkTypes(">>="), nameof(NpgsqlNetworkExtensions.ContainsOrContainedBy) => BoolReturningOnTwoNetworkTypes("&&"), - // TODO: Hack, see #1118 - nameof(NpgsqlNetworkExtensions.BitwiseNot) => new SqlUnaryExpression(ExpressionType.Negate, + nameof(NpgsqlNetworkExtensions.BitwiseNot) => new SqlUnaryExpression(ExpressionType.Not, arguments[1], arguments[1].Type, arguments[1].TypeMapping), diff --git a/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs b/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs index 20ce9266d..b429bedf3 100644 --- a/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs +++ b/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs @@ -193,8 +193,7 @@ protected override Expression VisitSqlUnary(SqlUnaryExpression sqlUnaryExpressio } // Bitwise complement on networking types - // TODO: Hack, see #1118 - case ExpressionType.Negate when + case ExpressionType.Not when sqlUnaryExpression.Operand.TypeMapping.ClrType == typeof(IPAddress) || sqlUnaryExpression.Operand.TypeMapping.ClrType == typeof((IPAddress, int)) || sqlUnaryExpression.Operand.TypeMapping.ClrType == typeof(PhysicalAddress): @@ -202,9 +201,8 @@ protected override Expression VisitSqlUnary(SqlUnaryExpression sqlUnaryExpressio Visit(sqlUnaryExpression.Operand); return sqlUnaryExpression; - // Negation on full-text queries - // TODO: Hack, see #1118 - case ExpressionType.Negate when sqlUnaryExpression.Operand.TypeMapping.ClrType == typeof(NpgsqlTsQuery): + // Not operation on full-text queries + case ExpressionType.Not when sqlUnaryExpression.Operand.TypeMapping.ClrType == typeof(NpgsqlTsQuery): Sql.Append("!!"); Visit(sqlUnaryExpression.Operand); return sqlUnaryExpression;