From d9a236c671a60fe53cb58f1560f276e361c85f16 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Mon, 6 Jun 2022 12:46:09 +0300 Subject: [PATCH] Change upper/lower case to align with PG conventions (#2397) --- .../NpgsqlNodaTimeMemberTranslatorPlugin.cs | 16 +- ...pgsqlNodaTimeMethodCallTranslatorPlugin.cs | 2 +- .../Internal/NpgsqlMathTranslator.cs | 32 +- .../Internal/NpgsqlNetworkTranslator.cs | 12 +- ...pgsqlQueryableAggregateMethodTranslator.cs | 18 +- .../Internal/NpgsqlStringMethodTranslator.cs | 2 +- .../Query/Internal/NpgsqlQuerySqlGenerator.cs | 4 +- .../NpgsqlSqlTranslatingExpressionVisitor.cs | 2 +- .../BuiltInDataTypesNpgsqlTest.cs | 6 +- test/EFCore.PG.FunctionalTests/Northwind.sql | 120 ++--- .../Query/ArrayArrayQueryTest.cs | 10 +- .../Query/ArrayListQueryTest.cs | 10 +- .../Query/BigIntegerQueryTest.cs | 6 +- .../Query/Ef6GroupByNpgsqlTest.cs | 2 +- .../FullTextSearchDbFunctionsNpgsqlTest.cs | 2 +- .../Query/GearsOfWarQueryNpgsqlTest.cs | 36 +- .../Query/JsonDomQueryTest.cs | 20 +- .../Query/JsonPocoQueryTest.cs | 24 +- .../Query/JsonStringQueryTest.cs | 14 +- .../Query/LTreeQueryTest.cs | 44 +- .../Query/MathQueryTest.cs | 48 +- .../Query/NetworkQueryNpgsqlTest.cs | 34 +- .../NorthwindDbFunctionsQueryNpgsqlTest.cs | 18 +- .../Query/NorthwindGroupByQueryNpgsqlTest.cs | 506 +++++++++--------- .../NorthwindMiscellaneousQueryNpgsqlTest.cs | 6 +- .../Query/NorthwindSelectQueryNpgsqlTest.cs | 2 +- .../NorthwindSetOperationsQueryNpgsqlTest.cs | 12 +- .../Query/NorthwindWhereQueryNpgsqlTest.cs | 36 +- .../Query/RangeQueryNpgsqlTest.cs | 8 +- .../Query/TimestampQueryTest.cs | 16 +- .../Query/UdfDbFunctionNpgsqlTests.cs | 6 +- .../NodaTimeQueryNpgsqlTest.cs | 106 ++-- 32 files changed, 590 insertions(+), 590 deletions(-) diff --git a/src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMemberTranslatorPlugin.cs b/src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMemberTranslatorPlugin.cs index de6b70f56..2c794647b 100644 --- a/src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMemberTranslatorPlugin.cs +++ b/src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMemberTranslatorPlugin.cs @@ -297,7 +297,7 @@ SqlExpression Upper() case "DayOfWeek": // Unlike DateTime.DayOfWeek, NodaTime's IsoDayOfWeek enum doesn't exactly correspond to PostgreSQL's - // values returned by DATE_PART('dow', ...): in NodaTime Sunday is 7 and not 0, which is None. + // values returned by date_part('dow', ...): in NodaTime Sunday is 7 and not 0, which is None. // So we generate a CASE WHEN expression to translate PostgreSQL's 0 to 7. var getValueExpression = GetDatePartExpression(instance, "dow", true); // TODO: Can be simplified once https://github.com/aspnet/EntityFrameworkCore/pull/16726 is in @@ -331,16 +331,16 @@ SqlExpression Upper() } /// - /// Constructs the DATE_PART expression. + /// Constructs the date_part expression. /// /// The member expression. - /// The name of the DATE_PART to construct. - /// True if the result should be wrapped with FLOOR(...); otherwise, false. + /// The name of the date_part to construct. + /// True if the result should be wrapped with floor(...); otherwise, false. /// - /// The DATE_PART expression. + /// The date_part expression. /// /// - /// DATE_PART returns doubles, which we floor and cast into ints + /// date_part returns doubles, which we floor and cast into ints /// This also gets rid of sub-second components when retrieving seconds. /// private SqlExpression GetDatePartExpression( @@ -358,7 +358,7 @@ private SqlExpression GetDatePartExpressionDouble( bool floor = false) { var result = _sqlExpressionFactory.Function( - "DATE_PART", + "date_part", new[] { _sqlExpressionFactory.Constant(partName), instance }, nullable: true, argumentsPropagateNullability: TrueArrays[2], @@ -367,7 +367,7 @@ private SqlExpression GetDatePartExpressionDouble( if (floor) { result = _sqlExpressionFactory.Function( - "FLOOR", + "floor", new[] { result }, nullable: true, argumentsPropagateNullability: TrueArrays[1], diff --git a/src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMethodCallTranslatorPlugin.cs b/src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMethodCallTranslatorPlugin.cs index 29247f3c2..bc249beb6 100644 --- a/src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMethodCallTranslatorPlugin.cs +++ b/src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMethodCallTranslatorPlugin.cs @@ -226,7 +226,7 @@ public NpgsqlNodaTimeMethodCallTranslator( static PostgresFunctionExpression IntervalPart(string datePart, SqlExpression parameter) => PostgresFunctionExpression.CreateWithNamedArguments( - "MAKE_INTERVAL", + "make_interval", new[] { parameter }, new[] { datePart }, nullable: true, diff --git a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMathTranslator.cs b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMathTranslator.cs index 255171329..ea528b2fc 100644 --- a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMathTranslator.cs +++ b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMathTranslator.cs @@ -72,24 +72,24 @@ public class NpgsqlMathTranslator : IMethodCallTranslator { typeof(MathF).GetRuntimeMethod(nameof(MathF.Tan), new[] { typeof(float) })!, "tan" }, // https://www.postgresql.org/docs/current/functions-conditional.html#FUNCTIONS-GREATEST-LEAST - { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(decimal), typeof(decimal) })!, "greatest" }, - { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(double), typeof(double) })!, "greatest" }, - { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(float), typeof(float) })!, "greatest" }, - { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(int), typeof(int) })!, "greatest" }, - { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(long), typeof(long) })!, "greatest" }, - { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(short), typeof(short) })!, "greatest" }, - { typeof(MathF).GetRuntimeMethod(nameof(MathF.Max), new[] { typeof(float), typeof(float) })!, "greatest" }, - { typeof(BigInteger).GetRuntimeMethod(nameof(BigInteger.Max), new[] { typeof(BigInteger), typeof(BigInteger) })!, "greatest" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(decimal), typeof(decimal) })!, "GREATEST" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(double), typeof(double) })!, "GREATEST" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(float), typeof(float) })!, "GREATEST" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(int), typeof(int) })!, "GREATEST" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(long), typeof(long) })!, "GREATEST" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Max), new[] { typeof(short), typeof(short) })!, "GREATEST" }, + { typeof(MathF).GetRuntimeMethod(nameof(MathF.Max), new[] { typeof(float), typeof(float) })!, "GREATEST" }, + { typeof(BigInteger).GetRuntimeMethod(nameof(BigInteger.Max), new[] { typeof(BigInteger), typeof(BigInteger) })!, "GREATEST" }, // https://www.postgresql.org/docs/current/functions-conditional.html#FUNCTIONS-GREATEST-LEAST - { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(decimal), typeof(decimal) })!, "least" }, - { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(double), typeof(double) })!, "least" }, - { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(float), typeof(float) })!, "least" }, - { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(int), typeof(int) })!, "least" }, - { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(long), typeof(long) })!, "least" }, - { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(short), typeof(short) })!, "least" }, - { typeof(MathF).GetRuntimeMethod(nameof(MathF.Min), new[] { typeof(float), typeof(float) })!, "least" }, - { typeof(BigInteger).GetRuntimeMethod(nameof(BigInteger.Min), new[] { typeof(BigInteger), typeof(BigInteger) })!, "least" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(decimal), typeof(decimal) })!, "LEAST" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(double), typeof(double) })!, "LEAST" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(float), typeof(float) })!, "LEAST" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(int), typeof(int) })!, "LEAST" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(long), typeof(long) })!, "LEAST" }, + { typeof(Math).GetRuntimeMethod(nameof(Math.Min), new[] { typeof(short), typeof(short) })!, "LEAST" }, + { typeof(MathF).GetRuntimeMethod(nameof(MathF.Min), new[] { typeof(float), typeof(float) })!, "LEAST" }, + { typeof(BigInteger).GetRuntimeMethod(nameof(BigInteger.Min), new[] { typeof(BigInteger), typeof(BigInteger) })!, "LEAST" }, }; private static readonly IEnumerable TruncateMethodInfos = new[] diff --git a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlNetworkTranslator.cs b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlNetworkTranslator.cs index 7ec9bc7a4..49d16ebe8 100644 --- a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlNetworkTranslator.cs +++ b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlNetworkTranslator.cs @@ -83,13 +83,13 @@ public NpgsqlNetworkTranslator( nameof(NpgsqlNetworkDbFunctionsExtensions.ContainsOrContainedBy) => _sqlExpressionFactory.MakePostgresBinary(PostgresExpressionType.NetworkContainsOrContainedBy, arguments[1], arguments[2]), - nameof(NpgsqlNetworkDbFunctionsExtensions.BitwiseNot) => new SqlUnaryExpression(ExpressionType.Not, - arguments[1], - arguments[1].Type, - arguments[1].TypeMapping), + nameof(NpgsqlNetworkDbFunctionsExtensions.BitwiseNot) + => new SqlUnaryExpression(ExpressionType.Not, arguments[1], arguments[1].Type, arguments[1].TypeMapping), - nameof(NpgsqlNetworkDbFunctionsExtensions.BitwiseAnd) => _sqlExpressionFactory.And(arguments[1], arguments[2]), - nameof(NpgsqlNetworkDbFunctionsExtensions.BitwiseOr) => _sqlExpressionFactory.Or(arguments[1], arguments[2]), + nameof(NpgsqlNetworkDbFunctionsExtensions.BitwiseAnd) + => _sqlExpressionFactory.And(arguments[1], arguments[2]), + nameof(NpgsqlNetworkDbFunctionsExtensions.BitwiseOr) + => _sqlExpressionFactory.Or(arguments[1], arguments[2]), // Add/Subtract accept inet + int, so we can't use the default type mapping inference logic which assumes // same-typed operands diff --git a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlQueryableAggregateMethodTranslator.cs b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlQueryableAggregateMethodTranslator.cs index 5bb1c494b..a9c0bf2e1 100644 --- a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlQueryableAggregateMethodTranslator.cs +++ b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlQueryableAggregateMethodTranslator.cs @@ -43,7 +43,7 @@ public NpgsqlQueryableAggregateMethodTranslator( return averageInputType == typeof(float) ? _sqlExpressionFactory.Convert( _sqlExpressionFactory.AggregateFunction( - "AVG", + "avg", new[] { averageSqlExpression }, nullable: true, argumentsPropagateNullability: FalseArrays[1], @@ -52,7 +52,7 @@ public NpgsqlQueryableAggregateMethodTranslator( averageSqlExpression.Type, averageSqlExpression.TypeMapping) : _sqlExpressionFactory.AggregateFunction( - "AVG", + "avg", new[] { averageSqlExpression }, nullable: true, argumentsPropagateNullability: FalseArrays[1], @@ -68,7 +68,7 @@ public NpgsqlQueryableAggregateMethodTranslator( return _sqlExpressionFactory.Convert( _sqlExpressionFactory.ApplyDefaultTypeMapping( _sqlExpressionFactory.AggregateFunction( - "COUNT", + "count", new[] { countSqlExpression }, nullable: false, argumentsPropagateNullability: FalseArrays[1], @@ -82,7 +82,7 @@ public NpgsqlQueryableAggregateMethodTranslator( var longCountSqlExpression = (source.Selector as SqlExpression) ?? _sqlExpressionFactory.Fragment("*"); return _sqlExpressionFactory.ApplyDefaultTypeMapping( _sqlExpressionFactory.AggregateFunction( - "COUNT", + "count", new[] { longCountSqlExpression }, nullable: false, argumentsPropagateNullability: FalseArrays[1], @@ -94,7 +94,7 @@ public NpgsqlQueryableAggregateMethodTranslator( || methodInfo == QueryableMethods.MaxWithSelector) && source.Selector is SqlExpression maxSqlExpression: return _sqlExpressionFactory.AggregateFunction( - "MAX", + "max", new[] { maxSqlExpression }, nullable: true, argumentsPropagateNullability: FalseArrays[1], @@ -107,7 +107,7 @@ public NpgsqlQueryableAggregateMethodTranslator( || methodInfo == QueryableMethods.MinWithSelector) && source.Selector is SqlExpression minSqlExpression: return _sqlExpressionFactory.AggregateFunction( - "MIN", + "min", new[] { minSqlExpression }, nullable: true, argumentsPropagateNullability: FalseArrays[1], @@ -129,7 +129,7 @@ public NpgsqlQueryableAggregateMethodTranslator( { return _sqlExpressionFactory.Convert( _sqlExpressionFactory.AggregateFunction( - "SUM", + "sum", new[] { sumSqlExpression }, nullable: true, argumentsPropagateNullability: FalseArrays[1], @@ -143,7 +143,7 @@ public NpgsqlQueryableAggregateMethodTranslator( { return _sqlExpressionFactory.Convert( _sqlExpressionFactory.AggregateFunction( - "SUM", + "sum", new[] { sumSqlExpression }, nullable: true, argumentsPropagateNullability: FalseArrays[1], @@ -154,7 +154,7 @@ public NpgsqlQueryableAggregateMethodTranslator( } return _sqlExpressionFactory.AggregateFunction( - "SUM", + "sum", new[] { sumSqlExpression }, nullable: true, argumentsPropagateNullability: FalseArrays[1], diff --git a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlStringMethodTranslator.cs b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlStringMethodTranslator.cs index b77a3c7a5..5872e68fc 100644 --- a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlStringMethodTranslator.cs +++ b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlStringMethodTranslator.cs @@ -69,7 +69,7 @@ public NpgsqlStringMethodTranslator( _whitespace = _sqlExpressionFactory.Constant( @" \t\n\r", // TODO: Complete this typeMappingSource.EStringTypeMapping); - _textTypeMapping = (RelationalTypeMapping)typeMappingSource.FindMapping(typeof(string), model)!; + _textTypeMapping = typeMappingSource.FindMapping(typeof(string), model)!; } public virtual SqlExpression? Translate( diff --git a/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs b/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs index 7b3f595a4..7dbb6e7b2 100644 --- a/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs +++ b/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs @@ -362,7 +362,7 @@ protected override Expression VisitSqlUnary(SqlUnaryExpression sqlUnaryExpressio case ScalarSubqueryExpression: var storeType = sqlUnaryExpression.TypeMapping.StoreType switch { - "integer" => "INT", + "integer" => "int", "timestamp with time zone" => "timestamptz", "timestamp without time zone" => "timestamp", var s => s @@ -631,7 +631,7 @@ public virtual Expression VisitJsonPathTraversal(PostgresJsonTraversalExpression Sql.Append(","); } } - Sql.Append("]::TEXT[]"); + Sql.Append("]::text[]"); } return expression; diff --git a/src/EFCore.PG/Query/Internal/NpgsqlSqlTranslatingExpressionVisitor.cs b/src/EFCore.PG/Query/Internal/NpgsqlSqlTranslatingExpressionVisitor.cs index 694ce860f..d95189da4 100644 --- a/src/EFCore.PG/Query/Internal/NpgsqlSqlTranslatingExpressionVisitor.cs +++ b/src/EFCore.PG/Query/Internal/NpgsqlSqlTranslatingExpressionVisitor.cs @@ -317,7 +317,7 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression) ExpressionType.Subtract, sqlLeft!, sqlRight!, _typeMappingSource.FindMapping(typeof(int)))!; return PostgresFunctionExpression.CreateWithNamedArguments( - "MAKE_INTERVAL", + "make_interval", new[] { subtraction }, new[] { "days" }, nullable: true, diff --git a/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs index 997343966..f120092b5 100644 --- a/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs @@ -912,13 +912,13 @@ public void Sum_Conversions() _ = context.Set().Sum(m => m.ShortAsSmallint); AssertSql( - @"SELECT COALESCE(SUM(m.""LongAsBigint""), 0.0)::bigint + @"SELECT COALESCE(sum(m.""LongAsBigint""), 0.0)::bigint FROM ""MappedDataTypes"" AS m", // - @"SELECT COALESCE(SUM(m.""Int""), 0)::int + @"SELECT COALESCE(sum(m.""Int""), 0)::int FROM ""MappedDataTypes"" AS m", // - @"SELECT COALESCE(SUM(m.""ShortAsSmallint""::INT), 0)::INT + @"SELECT COALESCE(sum(m.""ShortAsSmallint""::int), 0)::int FROM ""MappedDataTypes"" AS m"); } diff --git a/test/EFCore.PG.FunctionalTests/Northwind.sql b/test/EFCore.PG.FunctionalTests/Northwind.sql index 08313fcae..e68ec57de 100644 --- a/test/EFCore.PG.FunctionalTests/Northwind.sql +++ b/test/EFCore.PG.FunctionalTests/Northwind.sql @@ -31,7 +31,7 @@ CREATE TABLE "Employees" ( ( "EmployeeID" ), - CONSTRAINT "FK_Employees_Employees" FOREIGN KEY + CONSTRAINT "FK_Employees_Employees" FOREIGN KEY ( "ReportsTo" ) REFERENCES "Employees" ( @@ -50,7 +50,7 @@ CREATE TABLE "Categories" ( "CategoryName" varchar (15) NOT NULL , "Description" text NULL , "Picture" bytea NULL , - CONSTRAINT "PK_Categories" PRIMARY KEY + CONSTRAINT "PK_Categories" PRIMARY KEY ( "CategoryID" ) @@ -90,7 +90,7 @@ CREATE TABLE "Shippers" ( "ShipperID" SERIAL , "CompanyName" varchar (40) NOT NULL , "Phone" varchar (24) NULL , - CONSTRAINT "PK_Shippers" PRIMARY KEY + CONSTRAINT "PK_Shippers" PRIMARY KEY ( "ShipperID" ) @@ -109,7 +109,7 @@ CREATE TABLE "Suppliers" ( "Phone" varchar (24) NULL , "Fax" varchar (24) NULL , "HomePage" text NULL , - CONSTRAINT "PK_Suppliers" PRIMARY KEY + CONSTRAINT "PK_Suppliers" PRIMARY KEY ( "SupplierID" ) @@ -135,23 +135,23 @@ CREATE TABLE "Orders" ( "ShipRegion" varchar (15) NULL , "ShipPostalCode" varchar (10) NULL , "ShipCountry" varchar (15) NULL , - CONSTRAINT "PK_Orders" PRIMARY KEY + CONSTRAINT "PK_Orders" PRIMARY KEY ( "OrderID" ), - CONSTRAINT "FK_Orders_Customers" FOREIGN KEY + CONSTRAINT "FK_Orders_Customers" FOREIGN KEY ( "CustomerID" ) REFERENCES "Customers" ( "CustomerID" ), - CONSTRAINT "FK_Orders_Employees" FOREIGN KEY + CONSTRAINT "FK_Orders_Employees" FOREIGN KEY ( "EmployeeID" ) REFERENCES "Employees" ( "EmployeeID" ), - CONSTRAINT "FK_Orders_Shippers" FOREIGN KEY + CONSTRAINT "FK_Orders_Shippers" FOREIGN KEY ( "ShipVia" ) REFERENCES "Shippers" ( @@ -187,17 +187,17 @@ CREATE TABLE "Products" ( "UnitsOnOrder" smallint NULL CONSTRAINT "DF_Products_UnitsOnOrder" DEFAULT (0), "ReorderLevel" smallint NULL CONSTRAINT "DF_Products_ReorderLevel" DEFAULT (0), "Discontinued" boolean NOT NULL CONSTRAINT "DF_Products_Discontinued" DEFAULT (false), - CONSTRAINT "PK_Products" PRIMARY KEY + CONSTRAINT "PK_Products" PRIMARY KEY ( "ProductID" ), - CONSTRAINT "FK_Products_Categories" FOREIGN KEY + CONSTRAINT "FK_Products_Categories" FOREIGN KEY ( "CategoryID" ) REFERENCES "Categories" ( "CategoryID" ), - CONSTRAINT "FK_Products_Suppliers" FOREIGN KEY + CONSTRAINT "FK_Products_Suppliers" FOREIGN KEY ( "SupplierID" ) REFERENCES "Suppliers" ( @@ -231,13 +231,13 @@ CREATE TABLE "Order Details" ( "OrderID", "ProductID" ), - CONSTRAINT "FK_Order_Details_Orders" FOREIGN KEY + CONSTRAINT "FK_Order_Details_Orders" FOREIGN KEY ( "OrderID" ) REFERENCES "Orders" ( "OrderID" ), - CONSTRAINT "FK_Order_Details_Products" FOREIGN KEY + CONSTRAINT "FK_Order_Details_Products" FOREIGN KEY ( "ProductID" ) REFERENCES "Products" ( @@ -279,9 +279,9 @@ WHERE ((("Product_List"."Discontinued")=false)) GO create view "Orders Qry" AS -SELECT "Orders"."OrderID", "Orders"."CustomerID", "Orders"."EmployeeID", "Orders"."OrderDate", "Orders"."RequiredDate", - "Orders"."ShippedDate", "Orders"."ShipVia", "Orders"."Freight", "Orders"."ShipName", "Orders"."ShipAddress", "Orders"."ShipCity", - "Orders"."ShipRegion", "Orders"."ShipPostalCode", "Orders"."ShipCountry", +SELECT "Orders"."OrderID", "Orders"."CustomerID", "Orders"."EmployeeID", "Orders"."OrderDate", "Orders"."RequiredDate", + "Orders"."ShippedDate", "Orders"."ShipVia", "Orders"."Freight", "Orders"."ShipName", "Orders"."ShipAddress", "Orders"."ShipCity", + "Orders"."ShipRegion", "Orders"."ShipPostalCode", "Orders"."ShipCountry", "Customers"."CompanyName", "Customers"."Address", "Customers"."City", "Customers"."Region", "Customers"."PostalCode", "Customers"."Country" FROM "Customers" INNER JOIN "Orders" ON "Customers"."CustomerID" = "Orders"."CustomerID" GO @@ -307,28 +307,28 @@ WHERE "Orders"."OrderDate" BETWEEN '19970101' And '19971231' GO create view "Invoices" AS -SELECT "Orders"."ShipName", "Orders"."ShipAddress", "Orders"."ShipCity", "Orders"."ShipRegion", "Orders"."ShipPostalCode", - "Orders"."ShipCountry", "Orders"."CustomerID", "Customers"."CompanyName" AS "CustomerName", "Customers"."Address", "Customers"."City", - "Customers"."Region", "Customers"."PostalCode", "Customers"."Country", - ("FirstName" || ' ' || "LastName") AS "Salesperson", - "Orders"."OrderID", "Orders"."OrderDate", "Orders"."RequiredDate", "Orders"."ShippedDate", "Shippers"."CompanyName" As "ShipperName", - "Order Details"."ProductID", "Products"."ProductName", "Order Details"."UnitPrice", "Order Details"."Quantity", - "Order Details"."Discount", +SELECT "Orders"."ShipName", "Orders"."ShipAddress", "Orders"."ShipCity", "Orders"."ShipRegion", "Orders"."ShipPostalCode", + "Orders"."ShipCountry", "Orders"."CustomerID", "Customers"."CompanyName" AS "CustomerName", "Customers"."Address", "Customers"."City", + "Customers"."Region", "Customers"."PostalCode", "Customers"."Country", + ("FirstName" || ' ' || "LastName") AS "Salesperson", + "Orders"."OrderID", "Orders"."OrderDate", "Orders"."RequiredDate", "Orders"."ShippedDate", "Shippers"."CompanyName" As "ShipperName", + "Order Details"."ProductID", "Products"."ProductName", "Order Details"."UnitPrice", "Order Details"."Quantity", + "Order Details"."Discount", (("Order Details"."UnitPrice"*"Quantity"*(1-"Discount")/100)*100) AS "ExtendedPrice", "Orders"."Freight" -FROM "Shippers" INNER JOIN - ("Products" INNER JOIN +FROM "Shippers" INNER JOIN + ("Products" INNER JOIN ( - ("Employees" INNER JOIN - ("Customers" INNER JOIN "Orders" ON "Customers"."CustomerID" = "Orders"."CustomerID") - ON "Employees"."EmployeeID" = "Orders"."EmployeeID") - INNER JOIN "Order Details" ON "Orders"."OrderID" = "Order Details"."OrderID") - ON "Products"."ProductID" = "Order Details"."ProductID") + ("Employees" INNER JOIN + ("Customers" INNER JOIN "Orders" ON "Customers"."CustomerID" = "Orders"."CustomerID") + ON "Employees"."EmployeeID" = "Orders"."EmployeeID") + INNER JOIN "Order Details" ON "Orders"."OrderID" = "Order Details"."OrderID") + ON "Products"."ProductID" = "Order Details"."ProductID") ON "Shippers"."ShipperID" = "Orders"."ShipVia" GO create view "Order Details Extended" AS -SELECT "Order Details"."OrderID", "Order Details"."ProductID", "Products"."ProductName", - "Order Details"."UnitPrice", "Order Details"."Quantity", "Order Details"."Discount", +SELECT "Order Details"."OrderID", "Order Details"."ProductID", "Products"."ProductName", + "Order Details"."UnitPrice", "Order Details"."Quantity", "Order Details"."Discount", (("Order Details"."UnitPrice"*"Quantity"*(1-"Discount")/100)*100) AS "ExtendedPrice" FROM "Products" INNER JOIN "Order Details" ON "Products"."ProductID" = "Order Details"."ProductID" --ORDER BY "Order Details".OrderID @@ -341,11 +341,11 @@ GROUP BY "Order Details"."OrderID" GO create view "Product Sales for 1997" AS -SELECT "Categories"."CategoryName", "Products"."ProductName", +SELECT "Categories"."CategoryName", "Products"."ProductName", Sum(("Order Details"."UnitPrice"*"Quantity"*(1-"Discount")/100)*100) AS "ProductSales" -FROM ("Categories" INNER JOIN "Products" ON "Categories"."CategoryID" = "Products"."CategoryID") - INNER JOIN ("Orders" - INNER JOIN "Order Details" ON "Orders"."OrderID" = "Order Details"."OrderID") +FROM ("Categories" INNER JOIN "Products" ON "Categories"."CategoryID" = "Products"."CategoryID") + INNER JOIN ("Orders" + INNER JOIN "Order Details" ON "Orders"."OrderID" = "Order Details"."OrderID") ON "Products"."ProductID" = "Order Details"."ProductID" WHERE ((("Orders"."ShippedDate") Between '19970101' And '19971231')) GROUP BY "Categories"."CategoryName", "Products"."ProductName" @@ -358,12 +358,12 @@ GROUP BY "Product Sales for 1997"."CategoryName" GO create view "Sales by Category" AS -SELECT "Categories"."CategoryID", "Categories"."CategoryName", "Products"."ProductName", +SELECT "Categories"."CategoryID", "Categories"."CategoryName", "Products"."ProductName", Sum("Order Details Extended"."ExtendedPrice") AS "ProductSales" -FROM "Categories" INNER JOIN - ("Products" INNER JOIN - ("Orders" INNER JOIN "Order Details Extended" ON "Orders"."OrderID" = "Order Details Extended"."OrderID") - ON "Products"."ProductID" = "Order Details Extended"."ProductID") +FROM "Categories" INNER JOIN + ("Products" INNER JOIN + ("Orders" INNER JOIN "Order Details Extended" ON "Orders"."OrderID" = "Order Details Extended"."OrderID") + ON "Products"."ProductID" = "Order Details Extended"."ProductID") ON "Categories"."CategoryID" = "Products"."CategoryID" WHERE "Orders"."OrderDate" BETWEEN '19970101' And '19971231' GROUP BY "Categories"."CategoryID", "Categories"."CategoryName", "Products"."ProductName" @@ -372,8 +372,8 @@ GO create view "Sales Totals by Amount" AS SELECT "Order Subtotals"."Subtotal" AS "SaleAmount", "Orders"."OrderID", "Customers"."CompanyName", "Orders"."ShippedDate" -FROM "Customers" INNER JOIN - ("Orders" INNER JOIN "Order Subtotals" ON "Orders"."OrderID" = "Order Subtotals"."OrderID") +FROM "Customers" INNER JOIN + ("Orders" INNER JOIN "Order Subtotals" ON "Orders"."OrderID" = "Order Subtotals"."OrderID") ON "Customers"."CustomerID" = "Orders"."CustomerID" WHERE ("Order Subtotals"."Subtotal" > 2500) AND ("Orders"."ShippedDate" BETWEEN '19970101' And '19971231') GO @@ -406,8 +406,8 @@ CREATE FUNCTION "Employee Sales by Country" ("Beginning_Date" TIMESTAMP, "Ending RETURNS TABLE ("Country" VARCHAR(15), "LastName" VARCHAR(20), "FirstName" VARCHAR(10), "ShippedDate" TIMESTAMP, "OrderID" INT4, "Subtotal" DOUBLE PRECISION) AS ' SELECT "Employees"."Country", "Employees"."LastName", "Employees"."FirstName", "Orders"."ShippedDate", "Orders"."OrderID", "Order Subtotals"."Subtotal" AS "SaleAmount" -FROM "Employees" INNER JOIN - ("Orders" INNER JOIN "Order Subtotals" ON "Orders"."OrderID" = "Order Subtotals"."OrderID") +FROM "Employees" INNER JOIN + ("Orders" INNER JOIN "Order Subtotals" ON "Orders"."OrderID" = "Order Subtotals"."OrderID") ON "Employees"."EmployeeID" = "Orders"."EmployeeID" WHERE "Orders"."ShippedDate" Between "Beginning_Date" And "Ending_Date" ' LANGUAGE SQL; @@ -416,7 +416,7 @@ GO CREATE FUNCTION "Sales by Year" ("Beginning_Date" TIMESTAMP, "Ending_Date" TIMESTAMP) RETURNS TABLE ("ShippedDate" TIMESTAMP, "OrderID" INT4, "Subtotal" DOUBLE PRECISION, "Year" INT4) AS ' -SELECT "Orders"."ShippedDate", "Orders"."OrderID", "Order Subtotals"."Subtotal", DATE_PART("year","ShippedDate") AS "Year" +SELECT "Orders"."ShippedDate", "Orders"."OrderID", "Order Subtotals"."Subtotal", date_part("year","ShippedDate") AS "Year" FROM "Orders" INNER JOIN "Order Subtotals" ON "Orders"."OrderID" = "Order Subtotals"."OrderID" WHERE "Orders"."ShippedDate" Between "Beginning_Date" And "Ending_Date" ' LANGUAGE SQL; @@ -8884,7 +8884,7 @@ go --SELECT ProductName, -- UnitPrice=ROUND(Od.UnitPrice, 2), -- Quantity, --- Discount=CONVERT(int, Discount * 100), +-- Discount=CONVERT(int, Discount * 100), -- ExtendedPrice=ROUND(CONVERT(money, Quantity * (1 - Discount) * Od.UnitPrice), 2) --FROM Products P, [Order Details] Od --WHERE Od.ProductID = P.ProductID and Od.OrderID = @OrderID @@ -8897,7 +8897,7 @@ go -- --CREATE PROCEDURE CustOrdersOrders @CustomerID nchar(5) --AS ---SELECT OrderID, +--SELECT OrderID, -- OrderDate, -- RequiredDate, -- ShippedDate @@ -8924,7 +8924,7 @@ GO --CREATE PROCEDURE SalesByCategory -- @CategoryName varchar(15), @OrdYear varchar(4) = '1998' --AS ---IF @OrdYear != '1996' AND @OrdYear != '1997' AND @OrdYear != '1998' +--IF @OrdYear != '1996' AND @OrdYear != '1997' AND @OrdYear != '1998' --BEGIN -- SELECT @OrdYear = '1998' --END @@ -8932,8 +8932,8 @@ GO --SELECT ProductName, -- TotalPurchase=ROUND(SUM(CONVERT(decimal(14,2), OD.Quantity * (1-OD.Discount) * OD.UnitPrice)), 0) --FROM [Order Details] OD, Orders O, Products P, Categories C ---WHERE OD.OrderID = O.OrderID --- AND OD.ProductID = P.ProductID +--WHERE OD.OrderID = O.OrderID +-- AND OD.ProductID = P.ProductID -- AND P.CategoryID = C.CategoryID -- AND C.CategoryName = @CategoryName -- AND SUBSTRING(CONVERT(varchar(22), O.OrderDate, 111), 1, 4) = @OrdYear @@ -8953,13 +8953,13 @@ GO CREATE TABLE "CustomerDemographics" ("CustomerTypeID" char (10) NOT NULL , - "CustomerDesc" text NULL + "CustomerDesc" text NULL ) -GO - +GO + CREATE TABLE "Region" ( "RegionID" integer NOT NULL , - "RegionDescription" char (50) NOT NULL + "RegionDescription" char (50) NOT NULL ) GO @@ -8972,7 +8972,7 @@ GO CREATE TABLE "EmployeeTerritories" ("EmployeeID" integer NOT NULL, - "TerritoryID" varchar (20) NOT NULL + "TerritoryID" varchar (20) NOT NULL ) GO @@ -9110,7 +9110,7 @@ ALTER TABLE "CustomerDemographics" GO ALTER TABLE "CustomerCustomerDemo" - ADD CONSTRAINT "FK_CustomerCustomerDemo" FOREIGN KEY + ADD CONSTRAINT "FK_CustomerCustomerDemo" FOREIGN KEY ( "CustomerTypeID" ) REFERENCES "CustomerDemographics" ( @@ -9142,7 +9142,7 @@ ALTER TABLE "Territories" GO ALTER TABLE "Territories" - ADD CONSTRAINT "FK_Territories_Region" FOREIGN KEY + ADD CONSTRAINT "FK_Territories_Region" FOREIGN KEY ( "RegionID" ) REFERENCES "Region" ( @@ -9159,7 +9159,7 @@ ALTER TABLE "EmployeeTerritories" GO ALTER TABLE "EmployeeTerritories" - ADD CONSTRAINT "FK_EmployeeTerritories_Employees" FOREIGN KEY + ADD CONSTRAINT "FK_EmployeeTerritories_Employees" FOREIGN KEY ( "EmployeeID" ) REFERENCES "Employees" ( @@ -9169,7 +9169,7 @@ GO ALTER TABLE "EmployeeTerritories" - ADD CONSTRAINT "FK_EmployeeTerritories_Territories" FOREIGN KEY + ADD CONSTRAINT "FK_EmployeeTerritories_Territories" FOREIGN KEY ( "TerritoryID" ) REFERENCES "Territories" ( diff --git a/test/EFCore.PG.FunctionalTests/Query/ArrayArrayQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/ArrayArrayQueryTest.cs index 5aa8f5f36..cd36c9294 100644 --- a/test/EFCore.PG.FunctionalTests/Query/ArrayArrayQueryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/ArrayArrayQueryTest.cs @@ -215,7 +215,7 @@ public override void Array_column_Contains_null_parameter_does_not_work() ctx.SomeEntities.Count(e => e.StringArray.Contains(p))); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""SomeEntities"" AS s WHERE s.""StringArray"" @> ARRAY[NULL]::text[]"); } @@ -288,7 +288,7 @@ public override void Array_param_with_null_Contains_non_nullable_not_found() AssertSql( @"@__array_0={ 'unknown1', 'unknown2', NULL } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""SomeEntities"" AS s WHERE s.""NonNullableText"" = ANY (@__array_0)"); } @@ -304,7 +304,7 @@ public override void Array_param_with_null_Contains_non_nullable_not_found_negat AssertSql( @"@__array_0={ 'unknown1', 'unknown2', NULL } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""SomeEntities"" AS s WHERE NOT (s.""NonNullableText"" = ANY (@__array_0) AND ((s.""NonNullableText"" = ANY (@__array_0) IS NOT NULL)))"); } @@ -320,7 +320,7 @@ public override void Array_param_with_null_Contains_nullable_not_found() AssertSql( @"@__array_0={ 'unknown1', 'unknown2', NULL } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""SomeEntities"" AS s WHERE s.""NullableText"" = ANY (@__array_0) OR ((s.""NullableText"" IS NULL) AND (array_position(@__array_0, NULL) IS NOT NULL))"); } @@ -336,7 +336,7 @@ public override void Array_param_with_null_Contains_nullable_not_found_negated() AssertSql( @"@__array_0={ 'unknown1', 'unknown2', NULL } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""SomeEntities"" AS s WHERE NOT (s.""NullableText"" = ANY (@__array_0) AND ((s.""NullableText"" = ANY (@__array_0) IS NOT NULL))) AND ((s.""NullableText"" IS NOT NULL) OR (array_position(@__array_0, NULL) IS NULL))"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/ArrayListQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/ArrayListQueryTest.cs index b75e19bd8..1061e904d 100644 --- a/test/EFCore.PG.FunctionalTests/Query/ArrayListQueryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/ArrayListQueryTest.cs @@ -200,7 +200,7 @@ public override void Array_column_Contains_null_parameter_does_not_work() ctx.SomeEntities.Count(e => e.StringList.Contains(p))); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""SomeEntities"" AS s WHERE s.""StringList"" @> ARRAY[NULL]::text[]"); } @@ -279,7 +279,7 @@ public override void Array_param_with_null_Contains_non_nullable_not_found() AssertSql( @"@__array_0={ 'unknown1', 'unknown2', NULL } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""SomeEntities"" AS s WHERE s.""NonNullableText"" = ANY (@__array_0)"); } @@ -300,7 +300,7 @@ public override void Array_param_with_null_Contains_non_nullable_not_found_negat AssertSql( @"@__array_0={ 'unknown1', 'unknown2', NULL } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""SomeEntities"" AS s WHERE NOT (s.""NonNullableText"" = ANY (@__array_0) AND ((s.""NonNullableText"" = ANY (@__array_0) IS NOT NULL)))"); } @@ -321,7 +321,7 @@ public override void Array_param_with_null_Contains_nullable_not_found() AssertSql( @"@__array_0={ 'unknown1', 'unknown2', NULL } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""SomeEntities"" AS s WHERE s.""NullableText"" = ANY (@__array_0) OR ((s.""NullableText"" IS NULL) AND (array_position(@__array_0, NULL) IS NOT NULL))"); } @@ -342,7 +342,7 @@ public override void Array_param_with_null_Contains_nullable_not_found_negated() AssertSql( @"@__array_0={ 'unknown1', 'unknown2', NULL } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""SomeEntities"" AS s WHERE NOT (s.""NullableText"" = ANY (@__array_0) AND ((s.""NullableText"" = ANY (@__array_0) IS NOT NULL))) AND ((s.""NullableText"" IS NOT NULL) OR (array_position(@__array_0, NULL) IS NULL))"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/BigIntegerQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/BigIntegerQueryTest.cs index 035ccc0a3..6e3f6a1e8 100644 --- a/test/EFCore.PG.FunctionalTests/Query/BigIntegerQueryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/BigIntegerQueryTest.cs @@ -55,7 +55,7 @@ await AssertQuery( AssertSql( @"SELECT e.""Id"", e.""BigInteger"" FROM ""Entities"" AS e -WHERE greatest(e.""BigInteger"", 1) = 1"); +WHERE GREATEST(e.""BigInteger"", 1) = 1"); } [ConditionalTheory] @@ -70,7 +70,7 @@ await AssertQuery( AssertSql( @"SELECT e.""Id"", e.""BigInteger"" FROM ""Entities"" AS e -WHERE least(e.""BigInteger"", 1) = 1"); +WHERE LEAST(e.""BigInteger"", 1) = 1"); } [ConditionalTheory] @@ -210,4 +210,4 @@ public static IReadOnlyList CreateEntities() new() { Id = 5, BigInteger = new BigInteger(-1) }, }; } -} \ No newline at end of file +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Ef6GroupByNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Ef6GroupByNpgsqlTest.cs index 78fc2fdb7..59fe8f0cb 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Ef6GroupByNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Ef6GroupByNpgsqlTest.cs @@ -35,7 +35,7 @@ ORDER BY length(( SELECT p1.""LastName"" FROM ""Person"" AS p1 WHERE p1.""MiddleInitial"" = 'Q' AND p1.""Age"" = 20 AND (p.""LastName"" = p1.""LastName"" OR ((p.""LastName"" IS NULL) AND (p1.""LastName"" IS NULL))) - LIMIT 1))::INT NULLS FIRST"); + LIMIT 1))::int NULLS FIRST"); } public override async Task Whats_new_2021_sample_5(bool async) diff --git a/test/EFCore.PG.FunctionalTests/Query/FullTextSearchDbFunctionsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/FullTextSearchDbFunctionsNpgsqlTest.cs index 9fdf8eb7e..0b2a10911 100644 --- a/test/EFCore.PG.FunctionalTests/Query/FullTextSearchDbFunctionsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/FullTextSearchDbFunctionsNpgsqlTest.cs @@ -901,7 +901,7 @@ public void Match_and_boolean_operator_precedence() .Matches(EF.Functions.ToTsQuery("owner").Or(EF.Functions.ToTsQuery("foo")))); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE to_tsvector(c.""ContactTitle"") @@ (to_tsquery('owner') || to_tsquery('foo'))"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/GearsOfWarQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/GearsOfWarQueryNpgsqlTest.cs index 5eba520b0..0cccae055 100644 --- a/test/EFCore.PG.FunctionalTests/Query/GearsOfWarQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/GearsOfWarQueryNpgsqlTest.cs @@ -83,7 +83,7 @@ public override void Byte_array_filter_by_length_parameter_compiled() AssertSql( @"@__byteArrayParam='0x2A80' -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""Squads"" AS s WHERE length(s.""Banner"") = length(@__byteArrayParam)"); } @@ -137,7 +137,7 @@ public override async Task Where_datetimeoffset_hour_component(bool async) AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE date_part('hour', m.""Timeline"" AT TIME ZONE 'UTC')::INT = 10"); +WHERE date_part('hour', m.""Timeline"" AT TIME ZONE 'UTC')::int = 10"); } public override async Task DateTimeOffset_Date_returns_datetime(bool async) @@ -211,7 +211,7 @@ public override async Task TimeSpan_Hours(bool async) await base.TimeSpan_Hours(async); AssertSql( - @"SELECT floor(date_part('hour', m.""Duration""))::INT + @"SELECT floor(date_part('hour', m.""Duration""))::int FROM ""Missions"" AS m"); } @@ -220,7 +220,7 @@ public override async Task TimeSpan_Minutes(bool async) await base.TimeSpan_Minutes(async); AssertSql( - @"SELECT floor(date_part('minute', m.""Duration""))::INT + @"SELECT floor(date_part('minute', m.""Duration""))::int FROM ""Missions"" AS m"); } @@ -229,7 +229,7 @@ public override async Task TimeSpan_Seconds(bool async) await base.TimeSpan_Seconds(async); AssertSql( - @"SELECT floor(date_part('second', m.""Duration""))::INT + @"SELECT floor(date_part('second', m.""Duration""))::int FROM ""Missions"" AS m"); } @@ -238,7 +238,7 @@ public override async Task TimeSpan_Milliseconds(bool async) await base.TimeSpan_Milliseconds(async); AssertSql( - @"SELECT floor(date_part('millisecond', m.""Duration""))::INT % 1000 + @"SELECT floor(date_part('millisecond', m.""Duration""))::int % 1000 FROM ""Missions"" AS m"); } @@ -253,7 +253,7 @@ public override async Task Where_TimeSpan_Minutes(bool async) AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE floor(date_part('minute', m.""Duration""))::INT = 1"); +WHERE floor(date_part('minute', m.""Duration""))::int = 1"); } public override async Task Where_TimeSpan_Seconds(bool async) @@ -263,7 +263,7 @@ public override async Task Where_TimeSpan_Seconds(bool async) AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE floor(date_part('second', m.""Duration""))::INT = 1"); +WHERE floor(date_part('second', m.""Duration""))::int = 1"); } public override async Task Where_TimeSpan_Milliseconds(bool async) @@ -273,7 +273,7 @@ public override async Task Where_TimeSpan_Milliseconds(bool async) AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE (floor(date_part('millisecond', m.""Duration""))::INT % 1000) = 1"); +WHERE (floor(date_part('millisecond', m.""Duration""))::int % 1000) = 1"); } [ConditionalTheory] @@ -362,7 +362,7 @@ await AssertQuery( AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE make_date(date_part('year', m.""Date"")::INT, date_part('month', m.""Date"")::INT, 1) = DATE '1996-09-11'"); +WHERE make_date(date_part('year', m.""Date"")::int, date_part('month', m.""Date"")::int, 1) = DATE '1996-09-11'"); } [ConditionalTheory(Skip = "https://github.com/npgsql/efcore.pg/issues/2039")] @@ -376,7 +376,7 @@ await AssertQuery( AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE date_part('year', m.""Date"")::INT = 1990"); +WHERE date_part('year', m.""Date"")::int = 1990"); } public override async Task Where_DateOnly_Month(bool async) @@ -389,7 +389,7 @@ await AssertQuery( AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE date_part('month', m.""Date"")::INT = 11"); +WHERE date_part('month', m.""Date"")::int = 11"); } public override async Task Where_DateOnly_Day(bool async) @@ -402,7 +402,7 @@ await AssertQuery( AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE date_part('day', m.""Date"")::INT = 10"); +WHERE date_part('day', m.""Date"")::int = 10"); } public override async Task Where_DateOnly_DayOfYear(bool async) @@ -415,7 +415,7 @@ await AssertQuery( AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE date_part('doy', m.""Date"")::INT = 314"); +WHERE date_part('doy', m.""Date"")::int = 314"); } public override async Task Where_DateOnly_DayOfWeek(bool async) @@ -428,7 +428,7 @@ await AssertQuery( AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE floor(date_part('dow', m.""Date""))::INT = 6"); +WHERE floor(date_part('dow', m.""Date""))::int = 6"); } public override async Task Where_DateOnly_AddYears(bool async) @@ -484,7 +484,7 @@ await AssertQuery( AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE date_part('hour', m.""Time"")::INT = 10"); +WHERE date_part('hour', m.""Time"")::int = 10"); } public override async Task Where_TimeOnly_Minute(bool async) @@ -497,7 +497,7 @@ await AssertQuery( AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE date_part('minute', m.""Time"")::INT = 15"); +WHERE date_part('minute', m.""Time"")::int = 15"); } public override async Task Where_TimeOnly_Second(bool async) @@ -510,7 +510,7 @@ await AssertQuery( AssertSql( @"SELECT m.""Id"", m.""CodeName"", m.""Date"", m.""Duration"", m.""Rating"", m.""Time"", m.""Timeline"" FROM ""Missions"" AS m -WHERE date_part('second', m.""Time"")::INT = 50"); +WHERE date_part('second', m.""Time"")::int = 50"); } public override Task Where_TimeOnly_Millisecond(bool async) diff --git a/test/EFCore.PG.FunctionalTests/Query/JsonDomQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/JsonDomQueryTest.cs index 11c806b20..38a66c4df 100644 --- a/test/EFCore.PG.FunctionalTests/Query/JsonDomQueryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/JsonDomQueryTest.cs @@ -289,7 +289,7 @@ public void Array_parameter_index() SELECT j.""Id"", j.""CustomerDocument"", j.""CustomerElement"" FROM ""JsonbEntities"" AS j -WHERE CAST(j.""CustomerElement""#>>ARRAY['Statistics','Nested','IntArray',@__i_0]::TEXT[] AS integer) = 4 +WHERE CAST(j.""CustomerElement""#>>ARRAY['Statistics','Nested','IntArray',@__i_0]::text[] AS integer) = 4 LIMIT 2"); } @@ -387,7 +387,7 @@ public void JsonContains_with_json_element() AssertSql( @"@__element_1='{""Name"": ""Joe"", ""Age"": 25}' (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE j.""CustomerElement"" @> @__element_1"); } @@ -401,7 +401,7 @@ public void JsonContains_with_string() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE j.""CustomerElement"" @> '{""Name"": ""Joe"", ""Age"": 25}'"); } @@ -418,7 +418,7 @@ public void JsonContained_with_json_element() AssertSql( @"@__element_1='{""Name"": ""Joe"", ""Age"": 25}' (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE @__element_1 <@ j.""CustomerElement"""); } @@ -432,7 +432,7 @@ public void JsonContained_with_string() // Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE '{""Name"": ""Joe"", ""Age"": 25}' <@ j.""CustomerElement"""); } @@ -446,7 +446,7 @@ public void JsonExists() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE j.""CustomerElement""->'Statistics' ? 'Visits'"); } @@ -460,7 +460,7 @@ public void JsonExistAny() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE j.""CustomerElement""->'Statistics' ?| ARRAY['foo','Visits']::text[]"); } @@ -474,7 +474,7 @@ public void JsonExistAll() Assert.Equal(0, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE j.""CustomerElement""->'Statistics' ?& ARRAY['foo','Visits']::text[]"); } @@ -488,7 +488,7 @@ public void JsonTypeof() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE jsonb_typeof(j.""CustomerElement""#>'{Statistics,Visits}') = 'number'"); } @@ -502,7 +502,7 @@ public void JsonTypeof_json() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonEntities"" AS j WHERE json_typeof(j.""CustomerElement""#>'{Statistics,Visits}') = 'number'"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/JsonPocoQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/JsonPocoQueryTest.cs index a7e7aa99a..30cc373ca 100644 --- a/test/EFCore.PG.FunctionalTests/Query/JsonPocoQueryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/JsonPocoQueryTest.cs @@ -325,7 +325,7 @@ public void Array_parameter_index() SELECT j.""Id"", j.""Customer"", j.""ToplevelArray"" FROM ""JsonbEntities"" AS j -WHERE CAST(j.""Customer""#>>ARRAY['Statistics','Nested','IntArray',@__i_0]::TEXT[] AS integer) = 4 +WHERE CAST(j.""Customer""#>>ARRAY['Statistics','Nested','IntArray',@__i_0]::text[] AS integer) = 4 LIMIT 2"); } @@ -456,7 +456,7 @@ public void JsonContains_with_json_element() AssertSql( @"@__element_1='{""Name"": ""Joe"", ""Age"": 25}' (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE j.""Customer"" @> @__element_1"); } @@ -470,7 +470,7 @@ public void JsonContains_with_string_literal() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE j.""Customer"" @> '{""Name"": ""Joe"", ""Age"": 25}'"); } @@ -487,7 +487,7 @@ public void JsonContains_with_string_parameter() AssertSql( @"@__someJson_1='{""Name"": ""Joe"", ""Age"": 25}' (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE j.""Customer"" @> @__someJson_1"); } @@ -504,7 +504,7 @@ public void JsonContained_with_json_element() AssertSql( @"@__element_1='{""Name"": ""Joe"", ""Age"": 25}' (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE @__element_1 <@ j.""Customer"""); } @@ -518,7 +518,7 @@ public void JsonContained_with_string_literal() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE '{""Name"": ""Joe"", ""Age"": 25}' <@ j.""Customer"""); } @@ -535,7 +535,7 @@ public void JsonContained_with_string_parameter() AssertSql( @"@__someJson_1='{""Name"": ""Joe"", ""Age"": 25}' (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE @__someJson_1 <@ j.""Customer"""); } @@ -549,7 +549,7 @@ public void JsonExists() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE j.""Customer""->'Statistics' ? 'Visits'"); } @@ -563,7 +563,7 @@ public void JsonExistAny() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE j.""Customer""->'Statistics' ?| ARRAY['foo','Visits']::text[]"); } @@ -577,7 +577,7 @@ public void JsonExistAll() Assert.Equal(0, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE j.""Customer""->'Statistics' ?& ARRAY['foo','Visits']::text[]"); } @@ -591,7 +591,7 @@ public void JsonTypeof() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonbEntities"" AS j WHERE jsonb_typeof(j.""Customer""#>'{Statistics,Visits}') = 'number'"); } @@ -605,7 +605,7 @@ public void JsonTypeof_json() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonEntities"" AS j WHERE json_typeof(j.""Customer""#>'{Statistics,Visits}') = 'number'"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/JsonStringQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/JsonStringQueryTest.cs index 3d7e720ea..d9c53dbeb 100644 --- a/test/EFCore.PG.FunctionalTests/Query/JsonStringQueryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/JsonStringQueryTest.cs @@ -100,7 +100,7 @@ public void JsonContains_with_json_element() AssertSql( @"@__element_1='{""Name"": ""Joe"", ""Age"": 25}' (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""JsonEntities"" AS j WHERE j.""CustomerJsonb"" @> @__element_1"); } @@ -115,7 +115,7 @@ public void JsonContains_with_string() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonEntities"" AS j WHERE j.""CustomerJsonb"" @> '{""Name"": ""Joe"", ""Age"": 25}'"); } @@ -133,7 +133,7 @@ public void JsonContained_with_json_element() AssertSql( @"@__element_1='{""Name"": ""Joe"", ""Age"": 25}' (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""JsonEntities"" AS j WHERE @__element_1 <@ j.""CustomerJsonb"""); } @@ -148,7 +148,7 @@ public void JsonContained_with_string() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonEntities"" AS j WHERE '{""Name"": ""Joe"", ""Age"": 25}' <@ j.""CustomerJsonb"""); } @@ -163,7 +163,7 @@ public void JsonExists() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonEntities"" AS j WHERE j.""CustomerJsonb"" ? 'Age'"); } @@ -178,7 +178,7 @@ public void JsonExistAny() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonEntities"" AS j WHERE j.""CustomerJsonb"" ?| ARRAY['foo','Age']::text[]"); } @@ -193,7 +193,7 @@ public void JsonExistAll() Assert.Equal(0, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""JsonEntities"" AS j WHERE j.""CustomerJsonb"" ?& ARRAY['foo','Age']::text[]"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/LTreeQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/LTreeQueryTest.cs index e560469d8..46880116b 100644 --- a/test/EFCore.PG.FunctionalTests/Query/LTreeQueryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/LTreeQueryTest.cs @@ -34,7 +34,7 @@ public void Compare_to_string_literal() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE l.""Path"" = 'Top.Science'"); } @@ -50,7 +50,7 @@ public void Compare_to_string_parameter() AssertSql( @"@__p_0='Top.Science' (Nullable = false) (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE l.""Path"" = @__p_0"); } @@ -63,7 +63,7 @@ public void Compare_string_to_string_literal() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE l.""PathAsString"" = 'Top.Science'"); } @@ -76,7 +76,7 @@ public void LTree_cast_to_string() Assert.Equal(4, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE l.""Path""::text LIKE 'Top.Science%'"); } @@ -89,7 +89,7 @@ public void IsAncestorOf() Assert.Equal(4, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE 'Top.Science' @> l.""Path"""); } @@ -102,7 +102,7 @@ public void IsDescendentOf() Assert.Equal(4, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE l.""Path"" <@ 'Top.Science'"); } @@ -146,7 +146,7 @@ public void LTree_matches_LTxtQuery() Assert.Equal(3, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE l.""Path"" @ 'Astro*'"); } @@ -176,7 +176,7 @@ public void LTree_contains_any_LTree() AssertSql( @"@__ltrees_0={ 'Top.Science', 'Top.Art' } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 @> l.""Path"""); } @@ -192,7 +192,7 @@ public void LTree_contained_by_any_LTree() AssertSql( @"@__ltrees_0={ 'Top.Science.Astronomy', 'Top.Art' } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 <@ l.""Path"""); } @@ -208,7 +208,7 @@ public void Any_LTree_matches_LQuery() AssertSql( @"@__ltrees_0={ 'Top.Science.Astronomy.Astrophysics', 'Top.Science.Astronomy.Cosmology' } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 ~ '*.Astrophysics'"); } @@ -227,7 +227,7 @@ public void Any_LTree_matches_any_LQuery() @"@__ltrees_0={ 'Top.Science.Astronomy.Astrophysics', 'Top.Science.Astronomy.Cosmology' } (DbType = Object) @__lqueries_1={ '*.Astrophysics', '*.Geology' } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 ? @__lqueries_1"); } @@ -243,7 +243,7 @@ public void Any_LTree_matches_LTxtQuery() AssertSql( @"@__ltrees_0={ 'Top.Science.Astronomy.Astrophysics', 'Top.Science.Astronomy.Cosmology' } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 @ 'Astro*'"); } @@ -260,7 +260,7 @@ public void First_LTree_ancestor() AssertSql( @"@__ltrees_0={ 'Top.Science', 'Top.Hobbies' } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 ?@> l.""Path"" = 'Top.Science'"); } @@ -277,7 +277,7 @@ public void First_LTree_descendant() AssertSql( @"@__ltrees_0={ 'Top.Science.Astronomy', 'Top.Hobbies.Amateurs_Astronomy' } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 ?<@ l.""Path"" = 'Top.Science.Astronomy'"); } @@ -293,7 +293,7 @@ public void First_LTree_matches_LQuery() AssertSql( @"@__ltrees_0={ 'Top.Science.Astronomy.Astrophysics', 'Top.Science.Astronomy.Cosmology' } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 ?~ '*.Astrophysics' = 'Top.Science.Astronomy.Astrophysics'"); } @@ -309,7 +309,7 @@ public void First_LTree_matches_LTxtQuery() AssertSql( @"@__ltrees_0={ 'Top.Science.Astronomy.Astrophysics', 'Top.Science.Astronomy.Cosmology' } (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE @__ltrees_0 ?@ 'Astro*' = 'Top.Science.Astronomy.Astrophysics'"); } @@ -323,7 +323,7 @@ public void Subtree() Assert.Equal(7, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE subltree(l.""Path"", 0, 1) = 'Top'"); } @@ -337,7 +337,7 @@ public void Subpath1() Assert.Equal(4, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE subpath(l.""Path"", 0, 2) = 'Top.Science'"); } @@ -367,7 +367,7 @@ public void NLevel() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE nlevel(l.""Path"") = 2"); } @@ -381,7 +381,7 @@ public void Index1() Assert.Equal(3, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE index(l.""Path"", 'Astronomy') <> -1"); } @@ -395,7 +395,7 @@ public void Index2() Assert.Equal(0, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE index(l.""Path"", 'Top', 1) <> -1"); } @@ -409,7 +409,7 @@ public void LongestCommonAncestor() Assert.Equal(6, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""LTreeEntities"" AS l WHERE lca(ARRAY[l.""Path"",'Top.Hobbies']::ltree[]) = 'Top'"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/MathQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/MathQueryTest.cs index 898fd971d..a3db6b2b1 100644 --- a/test/EFCore.PG.FunctionalTests/Query/MathQueryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/MathQueryTest.cs @@ -22,7 +22,7 @@ public MathQueryTest(MathQueryNpgsqlFixture fixture, ITestOutputHelper testOutpu //Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - #region Greatest + #region GREATEST //[Fact] public void Max_ushort_ushort() @@ -33,7 +33,7 @@ public void Max_ushort_ushort() .Select(x => Math.Max(x.UShort, x.UShort)) .ToArray(); - AssertContainsSql("SELECT greatest(x.\"UShort\", x.\"UShort\")"); + AssertContainsSql("SELECT GREATEST(x.\"UShort\", x.\"UShort\")"); } //[Fact] @@ -45,7 +45,7 @@ public void Max_uint_uint() .Select(x => Math.Max(x.UInt, x.UInt)) .ToArray(); - AssertContainsSql("SELECT greatest(x.\"UInt\", x.\"UInt\")"); + AssertContainsSql("SELECT GREATEST(x.\"UInt\", x.\"UInt\")"); } //[Fact] @@ -57,7 +57,7 @@ public void Max_ulong_ulong() .Select(x => Math.Max(x.ULong, x.ULong)) .ToArray(); - AssertContainsSql("SELECT greatest(x.\"ULong\", x.\"ULong\")"); + AssertContainsSql("SELECT GREATEST(x.\"ULong\", x.\"ULong\")"); } [Fact] @@ -69,7 +69,7 @@ public void Max_short_short() .Select(x => Math.Max(x.Short, x.Short)) .ToArray(); - AssertContainsSql("SELECT greatest(x.\"Short\", x.\"Short\")"); + AssertContainsSql("SELECT GREATEST(x.\"Short\", x.\"Short\")"); } [Fact] @@ -81,7 +81,7 @@ public void Max_int_int() .Select(x => Math.Max(x.Int, x.Int)) .ToArray(); - AssertContainsSql("SELECT greatest(x.\"Int\", x.\"Int\")"); + AssertContainsSql("SELECT GREATEST(x.\"Int\", x.\"Int\")"); } [Fact] @@ -93,7 +93,7 @@ public void Max_long_long() .Select(x => Math.Max(x.Long, x.Long)) .ToArray(); - AssertContainsSql("SELECT greatest(x.\"Long\", x.\"Long\")"); + AssertContainsSql("SELECT GREATEST(x.\"Long\", x.\"Long\")"); } [Fact] @@ -105,7 +105,7 @@ public void Max_float_float() .Select(x => Math.Max(x.Float, x.Float)) .ToArray(); - AssertContainsSql("SELECT greatest(x.\"Float\", x.\"Float\")"); + AssertContainsSql("SELECT GREATEST(x.\"Float\", x.\"Float\")"); } [Fact] @@ -117,7 +117,7 @@ public void Max_double_double() .Select(x => Math.Max(x.Double, x.Double)) .ToArray(); - AssertContainsSql("SELECT greatest(x.\"Double\", x.\"Double\")"); + AssertContainsSql("SELECT GREATEST(x.\"Double\", x.\"Double\")"); } [Fact] @@ -129,7 +129,7 @@ public void Max_decimal_decimal() .Select(x => Math.Max(x.Decimal, x.Decimal)) .ToArray(); - AssertContainsSql("SELECT greatest(x.\"Decimal\", x.\"Decimal\")"); + AssertContainsSql("SELECT GREATEST(x.\"Decimal\", x.\"Decimal\")"); } //[Fact] @@ -141,7 +141,7 @@ public void Max_sbyte_sbyte() .Select(x => Math.Max(x.SByte, x.SByte)) .ToArray(); - AssertContainsSql("SELECT greatest(x.\"SByte\", x.\"SByte\")"); + AssertContainsSql("SELECT GREATEST(x.\"SByte\", x.\"SByte\")"); } //[Fact] @@ -153,7 +153,7 @@ public void Max_byte_byte() .Select(x => Math.Max(x.Byte, x.Byte)) .ToArray(); - AssertContainsSql("SELECT greatest(x.\"Byte\", x.\"Byte\")"); + AssertContainsSql("SELECT GREATEST(x.\"Byte\", x.\"Byte\")"); } #endregion @@ -169,7 +169,7 @@ public void Min_ushort_ushort() .Select(x => Math.Min(x.UShort, x.UShort)) .ToArray(); - AssertContainsSql("SELECT least(x.\"UShort\", x.\"UShort\")"); + AssertContainsSql("SELECT LEAST(x.\"UShort\", x.\"UShort\")"); } //[Fact] @@ -181,7 +181,7 @@ public void Min_uint_uint() .Select(x => Math.Min(x.UInt, x.UInt)) .ToArray(); - AssertContainsSql("SELECT least(x.\"UInt\", x.\"UInt\")"); + AssertContainsSql("SELECT LEAST(x.\"UInt\", x.\"UInt\")"); } //[Fact] @@ -193,7 +193,7 @@ public void Min_ulong_ulong() .Select(x => Math.Min(x.ULong, x.ULong)) .ToArray(); - AssertContainsSql("SELECT least(x.\"ULong\", x.\"ULong\")"); + AssertContainsSql("SELECT LEAST(x.\"ULong\", x.\"ULong\")"); } [Fact] @@ -205,7 +205,7 @@ public void Min_short_short() .Select(x => Math.Min(x.Short, x.Short)) .ToArray(); - AssertContainsSql("SELECT least(x.\"Short\", x.\"Short\")"); + AssertContainsSql("SELECT LEAST(x.\"Short\", x.\"Short\")"); } [Fact] @@ -217,7 +217,7 @@ public void Min_int_int() .Select(x => Math.Min(x.Int, x.Int)) .ToArray(); - AssertContainsSql("SELECT least(x.\"Int\", x.\"Int\")"); + AssertContainsSql("SELECT LEAST(x.\"Int\", x.\"Int\")"); } [Fact] @@ -229,7 +229,7 @@ public void Min_long_long() .Select(x => Math.Min(x.Long, x.Long)) .ToArray(); - AssertContainsSql("SELECT least(x.\"Long\", x.\"Long\")"); + AssertContainsSql("SELECT LEAST(x.\"Long\", x.\"Long\")"); } [Fact] @@ -241,7 +241,7 @@ public void Min_float_float() .Select(x => Math.Min(x.Float, x.Float)) .ToArray(); - AssertContainsSql("SELECT least(x.\"Float\", x.\"Float\")"); + AssertContainsSql("SELECT LEAST(x.\"Float\", x.\"Float\")"); } [Fact] @@ -253,7 +253,7 @@ public void Min_double_double() .Select(x => Math.Min(x.Double, x.Double)) .ToArray(); - AssertContainsSql("SELECT least(x.\"Double\", x.\"Double\")"); + AssertContainsSql("SELECT LEAST(x.\"Double\", x.\"Double\")"); } [Fact] @@ -265,7 +265,7 @@ public void Min_decimal_decimal() .Select(x => Math.Min(x.Decimal, x.Decimal)) .ToArray(); - AssertContainsSql("SELECT least(x.\"Decimal\", x.\"Decimal\")"); + AssertContainsSql("SELECT LEAST(x.\"Decimal\", x.\"Decimal\")"); } //[Fact] @@ -277,7 +277,7 @@ public void Min_sbyte_sbyte() .Select(x => Math.Min(x.SByte, x.SByte)) .ToArray(); - AssertContainsSql("SELECT least(x.\"SByte\", x.\"SByte\")"); + AssertContainsSql("SELECT LEAST(x.\"SByte\", x.\"SByte\")"); } //[Fact] @@ -289,7 +289,7 @@ public void Min_byte_byte() .Select(x => Math.Min(x.Byte, x.Byte)) .ToArray(); - AssertContainsSql("SELECT least(x.\"Byte\", x.\"Byte\")"); + AssertContainsSql("SELECT LEAST(x.\"Byte\", x.\"Byte\")"); } #endregion @@ -355,4 +355,4 @@ public void AssertContainsSql(string sql) => Fixture.TestSqlLoggerFactory.Sql.Replace(Environment.NewLine, " ").Remove('\r').Remove('\n')); #endregion -} \ No newline at end of file +} diff --git a/test/EFCore.PG.FunctionalTests/Query/NetworkQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/NetworkQueryNpgsqlTest.cs index 3a48bf877..eb4a9dc66 100644 --- a/test/EFCore.PG.FunctionalTests/Query/NetworkQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/NetworkQueryNpgsqlTest.cs @@ -59,7 +59,7 @@ public void IPAddress_inet_parse_column() Assert.Equal(9, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Inet"" = n.""TextInet""::inet OR ((n.""Inet"" IS NULL) AND (n.""TextInet"" IS NULL))"); } @@ -72,7 +72,7 @@ public void PhysicalAddress_macaddr_parse_column() Assert.Equal(9, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Macaddr"" = n.""TextMacaddr""::macaddr OR ((n.""Macaddr"" IS NULL) AND (n.""TextMacaddr"" IS NULL))"); } @@ -85,7 +85,7 @@ public void IPAddress_inet_parse_literal() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Inet"" = INET '192.168.1.2'"); } @@ -98,7 +98,7 @@ public void PhysicalAddress_macaddr_parse_literal() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Macaddr"" = MACADDR '123456000002'"); } @@ -135,7 +135,7 @@ public void IPAddress_inet_LessThan_inet() Assert.Equal(6, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Inet"" < INET '192.168.1.7'"); } @@ -165,7 +165,7 @@ public void PhysicalAddress_macaddr_LessThan_macaddr() Assert.Equal(6, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Macaddr"" < MACADDR '123456000007'"); } @@ -179,7 +179,7 @@ public void PhysicalAddress_macaddr8_LessThan_macaddr8() Assert.Equal(6, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Macaddr8"" < MACADDR8 '08002B0102030407'"); } @@ -192,7 +192,7 @@ public void IPAddress_inet_LessThanOrEqual_inet() Assert.Equal(7, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Inet"" <= INET '192.168.1.7'"); } @@ -222,7 +222,7 @@ public void PhysicalAddress_macaddr_LessThanOrEqual_macaddr() Assert.Equal(7, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Macaddr"" <= MACADDR '123456000007'"); } @@ -236,7 +236,7 @@ public void PhysicalAddress_macaddr8_LessThanOrEqual_macaddr8() Assert.Equal(7, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Macaddr8"" <= MACADDR8 '08002B0102030407'"); } @@ -249,7 +249,7 @@ public void IPAddress_inet_GreaterThanOrEqual_inet() Assert.Equal(3, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Inet"" >= INET '192.168.1.7'"); } @@ -279,7 +279,7 @@ public void PhysicalAddress_macaddr_GreaterThanOrEqual_macaddr() Assert.Equal(3, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Macaddr"" >= MACADDR '123456000007'"); } @@ -293,7 +293,7 @@ public void PhysicalAddress_macaddr8_GreaterThanOrEqual_macaddr8() Assert.Equal(3, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Macaddr8"" >= MACADDR8 '08002B0102030407'"); } @@ -306,7 +306,7 @@ public void IPAddress_inet_GreaterThan_inet() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Inet"" > INET '192.168.1.7'"); } @@ -336,7 +336,7 @@ public void PhysicalAddress_macaddr_GreaterThan_macaddr() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Macaddr"" > MACADDR '123456000007'"); } @@ -350,7 +350,7 @@ public void PhysicalAddress_macaddr8_GreaterThan_macaddr8() Assert.Equal(2, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Macaddr8"" > MACADDR8 '08002B0102030407'"); } @@ -699,7 +699,7 @@ public void IPAddress_inet_BitwiseAnd_inet() AssertSql( @"@__inet_1='0.0.0.0' (DbType = Object) -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""NetTestEntities"" AS n WHERE n.""Inet"" = (n.""Inet"" & @__inet_1) OR (n.""Inet"" IS NULL)"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/NorthwindDbFunctionsQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/NorthwindDbFunctionsQueryNpgsqlTest.cs index c0a24e793..55441ee25 100644 --- a/test/EFCore.PG.FunctionalTests/Query/NorthwindDbFunctionsQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/NorthwindDbFunctionsQueryNpgsqlTest.cs @@ -28,7 +28,7 @@ await AssertCount( c => c.ContactName.Contains("M")); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE c.""ContactName"" LIKE '%M%'"); } @@ -38,7 +38,7 @@ public override async Task Like_identity(bool async) await base.Like_identity(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE c.""ContactName"" LIKE c.""ContactName"" ESCAPE ''"); } @@ -48,7 +48,7 @@ public override async Task Like_literal_with_escape(bool async) await base.Like_literal_with_escape(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE c.""ContactName"" LIKE '!%' ESCAPE '!'"); } @@ -61,7 +61,7 @@ public void String_Like_Literal_With_Backslash() Assert.Equal(0, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE c.""ContactName"" LIKE '\' ESCAPE ''"); } @@ -74,7 +74,7 @@ public void String_ILike_Literal() Assert.Equal(34, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE c.""ContactName"" ILIKE '%M%'"); } @@ -87,7 +87,7 @@ public void String_ILike_Literal_With_Escape() Assert.Equal(0, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE c.""ContactName"" ILIKE '!%' ESCAPE '!'"); } @@ -103,7 +103,7 @@ public override async Task Collate_case_insensitive(bool async) await base.Collate_case_insensitive(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE c.""ContactName"" COLLATE ""some-case-insensitive-collation"" = 'maria anders'"); } @@ -113,7 +113,7 @@ public override async Task Collate_case_sensitive(bool async) await base.Collate_case_sensitive(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE c.""ContactName"" COLLATE ""POSIX"" = 'maria anders'"); } @@ -133,7 +133,7 @@ public void String_reverse() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE reverse(c.""ContactName"") = 'srednA airaM'"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/NorthwindGroupByQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/NorthwindGroupByQueryNpgsqlTest.cs index ad485b611..d61a10025 100644 --- a/test/EFCore.PG.FunctionalTests/Query/NorthwindGroupByQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/NorthwindGroupByQueryNpgsqlTest.cs @@ -20,7 +20,7 @@ public override async Task GroupBy_Property_Select_Average(bool async) await base.GroupBy_Property_Select_Average(async); AssertSql( - @"SELECT AVG(o.""OrderID""::double precision) + @"SELECT avg(o.""OrderID""::double precision) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); @@ -42,7 +42,7 @@ public override async Task GroupBy_Property_Select_Count(bool async) await base.GroupBy_Property_Select_Count(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -52,7 +52,7 @@ public override async Task GroupBy_Property_Select_LongCount(bool async) await base.GroupBy_Property_Select_LongCount(async); AssertSql( - @"SELECT COUNT(*) + @"SELECT count(*) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -62,7 +62,7 @@ public override async Task GroupBy_Property_Select_Count_with_nulls(bool async) await base.GroupBy_Property_Select_Count_with_nulls(async); AssertSql( - @"SELECT c.""City"", COUNT(*)::INT AS ""Faxes"" + @"SELECT c.""City"", count(*)::int AS ""Faxes"" FROM ""Customers"" AS c GROUP BY c.""City"""); } @@ -72,7 +72,7 @@ public override async Task GroupBy_Property_Select_LongCount_with_nulls(bool asy await base.GroupBy_Property_Select_LongCount_with_nulls(async); AssertSql( - @"SELECT c.""City"", COUNT(*) AS ""Faxes"" + @"SELECT c.""City"", count(*) AS ""Faxes"" FROM ""Customers"" AS c GROUP BY c.""City"""); } @@ -82,7 +82,7 @@ public override async Task GroupBy_Property_Select_Max(bool async) await base.GroupBy_Property_Select_Max(async); AssertSql( - @"SELECT MAX(o.""OrderID"") + @"SELECT max(o.""OrderID"") FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -92,7 +92,7 @@ public override async Task GroupBy_Property_Select_Min(bool async) await base.GroupBy_Property_Select_Min(async); AssertSql( - @"SELECT MIN(o.""OrderID"") + @"SELECT min(o.""OrderID"") FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -102,7 +102,7 @@ public override async Task GroupBy_Property_Select_Sum(bool async) await base.GroupBy_Property_Select_Sum(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -112,7 +112,7 @@ public override async Task GroupBy_Property_Select_Sum_Min_Max_Avg(bool async) await base.GroupBy_Property_Select_Sum_Min_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -122,7 +122,7 @@ public override async Task GroupBy_Property_Select_Key_Average(bool async) await base.GroupBy_Property_Select_Key_Average(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", AVG(o.""OrderID""::double precision) AS ""Average"" + @"SELECT o.""CustomerID"" AS ""Key"", avg(o.""OrderID""::double precision) AS ""Average"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -132,7 +132,7 @@ public override async Task GroupBy_Property_Select_Key_Count(bool async) await base.GroupBy_Property_Select_Key_Count(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT o.""CustomerID"" AS ""Key"", count(*)::int AS ""Count"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -142,7 +142,7 @@ public override async Task GroupBy_Property_Select_Key_LongCount(bool async) await base.GroupBy_Property_Select_Key_LongCount(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COUNT(*) AS ""LongCount"" + @"SELECT o.""CustomerID"" AS ""Key"", count(*) AS ""LongCount"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -152,7 +152,7 @@ public override async Task GroupBy_Property_Select_Key_Max(bool async) await base.GroupBy_Property_Select_Key_Max(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", MAX(o.""OrderID"") AS ""Max"" + @"SELECT o.""CustomerID"" AS ""Key"", max(o.""OrderID"") AS ""Max"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -162,7 +162,7 @@ public override async Task GroupBy_Property_Select_Key_Min(bool async) await base.GroupBy_Property_Select_Key_Min(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", MIN(o.""OrderID"") AS ""Min"" + @"SELECT o.""CustomerID"" AS ""Key"", min(o.""OrderID"") AS ""Min"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -172,7 +172,7 @@ public override async Task GroupBy_Property_Select_Key_Sum(bool async) await base.GroupBy_Property_Select_Key_Sum(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"" + @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -182,7 +182,7 @@ public override async Task GroupBy_Property_Select_Key_Sum_Min_Max_Avg(bool asyn await base.GroupBy_Property_Select_Key_Sum_Min_Max_Avg(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -192,7 +192,7 @@ public override async Task GroupBy_Property_Select_Sum_Min_Key_Max_Avg(bool asyn await base.GroupBy_Property_Select_Sum_Min_Key_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", o.""CustomerID"" AS ""Key"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", o.""CustomerID"" AS ""Key"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -202,7 +202,7 @@ public override async Task GroupBy_Property_Select_key_multiple_times_and_aggreg await base.GroupBy_Property_Select_key_multiple_times_and_aggregate(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key1"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"" + @"SELECT o.""CustomerID"" AS ""Key1"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -212,7 +212,7 @@ public override async Task GroupBy_Property_Select_Key_with_constant(bool async) await base.GroupBy_Property_Select_Key_with_constant(async); AssertSql( - @"SELECT t.""Name"", t.""CustomerID"" AS ""Value"", COUNT(*)::INT AS ""Count"" + @"SELECT t.""Name"", t.""CustomerID"" AS ""Value"", count(*)::int AS ""Count"" FROM ( SELECT o.""CustomerID"", 'CustomerID' AS ""Name"" FROM ""Orders"" AS o @@ -226,11 +226,11 @@ public override async Task GroupBy_aggregate_projecting_conditional_expression(b AssertSql( @"SELECT o.""OrderDate"" AS ""Key"", CASE - WHEN COUNT(*)::INT = 0 THEN 1 - ELSE COALESCE(SUM(CASE + WHEN count(*)::int = 0 THEN 1 + ELSE COALESCE(sum(CASE WHEN (o.""OrderID"" % 2) = 0 THEN 1 ELSE 0 - END), 0)::INT / COUNT(*)::INT + END), 0)::int / count(*)::int END AS ""SomeValue"" FROM ""Orders"" AS o GROUP BY o.""OrderDate"""); @@ -244,7 +244,7 @@ public override async Task GroupBy_aggregate_projecting_conditional_expression_b @"SELECT CASE WHEN (o.""OrderDate"" IS NULL) THEN 'is null' ELSE 'is not null' -END AS ""Key"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"" +END AS ""Key"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"" FROM ""Orders"" AS o GROUP BY o.""OrderDate"""); } @@ -254,7 +254,7 @@ public override async Task GroupBy_anonymous_Select_Average(bool async) await base.GroupBy_anonymous_Select_Average(async); AssertSql( - @"SELECT AVG(o.""OrderID""::double precision) + @"SELECT avg(o.""OrderID""::double precision) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -264,7 +264,7 @@ public override async Task GroupBy_anonymous_Select_Count(bool async) await base.GroupBy_anonymous_Select_Count(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -274,7 +274,7 @@ public override async Task GroupBy_anonymous_Select_LongCount(bool async) await base.GroupBy_anonymous_Select_LongCount(async); AssertSql( - @"SELECT COUNT(*) + @"SELECT count(*) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -284,7 +284,7 @@ public override async Task GroupBy_anonymous_Select_Max(bool async) await base.GroupBy_anonymous_Select_Max(async); AssertSql( - @"SELECT MAX(o.""OrderID"") + @"SELECT max(o.""OrderID"") FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -294,7 +294,7 @@ public override async Task GroupBy_anonymous_Select_Min(bool async) await base.GroupBy_anonymous_Select_Min(async); AssertSql( - @"SELECT MIN(o.""OrderID"") + @"SELECT min(o.""OrderID"") FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -304,7 +304,7 @@ public override async Task GroupBy_anonymous_Select_Sum(bool async) await base.GroupBy_anonymous_Select_Sum(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -314,7 +314,7 @@ public override async Task GroupBy_anonymous_Select_Sum_Min_Max_Avg(bool async) await base.GroupBy_anonymous_Select_Sum_Min_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -324,7 +324,7 @@ public override async Task GroupBy_anonymous_with_alias_Select_Key_Sum(bool asyn await base.GroupBy_anonymous_with_alias_Select_Key_Sum(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"" + @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -334,7 +334,7 @@ public override async Task GroupBy_Composite_Select_Average(bool async) await base.GroupBy_Composite_Select_Average(async); AssertSql( - @"SELECT AVG(o.""OrderID""::double precision) + @"SELECT avg(o.""OrderID""::double precision) FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -344,7 +344,7 @@ public override async Task GroupBy_Composite_Select_Count(bool async) await base.GroupBy_Composite_Select_Count(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -354,7 +354,7 @@ public override async Task GroupBy_Composite_Select_LongCount(bool async) await base.GroupBy_Composite_Select_LongCount(async); AssertSql( - @"SELECT COUNT(*) + @"SELECT count(*) FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -364,7 +364,7 @@ public override async Task GroupBy_Composite_Select_Max(bool async) await base.GroupBy_Composite_Select_Max(async); AssertSql( - @"SELECT MAX(o.""OrderID"") + @"SELECT max(o.""OrderID"") FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -374,7 +374,7 @@ public override async Task GroupBy_Composite_Select_Min(bool async) await base.GroupBy_Composite_Select_Min(async); AssertSql( - @"SELECT MIN(o.""OrderID"") + @"SELECT min(o.""OrderID"") FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -384,7 +384,7 @@ public override async Task GroupBy_Composite_Select_Sum(bool async) await base.GroupBy_Composite_Select_Sum(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -394,7 +394,7 @@ public override async Task GroupBy_Composite_Select_Sum_Min_Max_Avg(bool async) await base.GroupBy_Composite_Select_Sum_Min_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -404,7 +404,7 @@ public override async Task GroupBy_Composite_Select_Key_Average(bool async) await base.GroupBy_Composite_Select_Key_Average(async); AssertSql( - @"SELECT o.""CustomerID"", o.""EmployeeID"", AVG(o.""OrderID""::double precision) AS ""Average"" + @"SELECT o.""CustomerID"", o.""EmployeeID"", avg(o.""OrderID""::double precision) AS ""Average"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -414,7 +414,7 @@ public override async Task GroupBy_Composite_Select_Key_Count(bool async) await base.GroupBy_Composite_Select_Key_Count(async); AssertSql( - @"SELECT o.""CustomerID"", o.""EmployeeID"", COUNT(*)::INT AS ""Count"" + @"SELECT o.""CustomerID"", o.""EmployeeID"", count(*)::int AS ""Count"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -424,7 +424,7 @@ public override async Task GroupBy_Composite_Select_Key_LongCount(bool async) await base.GroupBy_Composite_Select_Key_LongCount(async); AssertSql( - @"SELECT o.""CustomerID"", o.""EmployeeID"", COUNT(*) AS ""LongCount"" + @"SELECT o.""CustomerID"", o.""EmployeeID"", count(*) AS ""LongCount"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -434,7 +434,7 @@ public override async Task GroupBy_Composite_Select_Key_Max(bool async) await base.GroupBy_Composite_Select_Key_Max(async); AssertSql( - @"SELECT o.""CustomerID"", o.""EmployeeID"", MAX(o.""OrderID"") AS ""Max"" + @"SELECT o.""CustomerID"", o.""EmployeeID"", max(o.""OrderID"") AS ""Max"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -444,7 +444,7 @@ public override async Task GroupBy_Composite_Select_Key_Min(bool async) await base.GroupBy_Composite_Select_Key_Min(async); AssertSql( - @"SELECT o.""CustomerID"", o.""EmployeeID"", MIN(o.""OrderID"") AS ""Min"" + @"SELECT o.""CustomerID"", o.""EmployeeID"", min(o.""OrderID"") AS ""Min"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -454,7 +454,7 @@ public override async Task GroupBy_Composite_Select_Key_Sum(bool async) await base.GroupBy_Composite_Select_Key_Sum(async); AssertSql( - @"SELECT o.""CustomerID"", o.""EmployeeID"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"" + @"SELECT o.""CustomerID"", o.""EmployeeID"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -464,7 +464,7 @@ public override async Task GroupBy_Composite_Select_Key_Sum_Min_Max_Avg(bool asy await base.GroupBy_Composite_Select_Key_Sum_Min_Max_Avg(async); AssertSql( - @"SELECT o.""CustomerID"", o.""EmployeeID"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT o.""CustomerID"", o.""EmployeeID"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -474,7 +474,7 @@ public override async Task GroupBy_Composite_Select_Sum_Min_Key_Max_Avg(bool asy await base.GroupBy_Composite_Select_Sum_Min_Key_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", o.""CustomerID"", o.""EmployeeID"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", o.""CustomerID"", o.""EmployeeID"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -484,7 +484,7 @@ public override async Task GroupBy_Composite_Select_Sum_Min_Key_flattened_Max_Av await base.GroupBy_Composite_Select_Sum_Min_Key_flattened_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", o.""CustomerID"", o.""EmployeeID"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", o.""CustomerID"", o.""EmployeeID"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -494,7 +494,7 @@ public override async Task GroupBy_Dto_as_key_Select_Sum(bool async) await base.GroupBy_Dto_as_key_Select_Sum(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", o.""CustomerID"", o.""EmployeeID"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", o.""CustomerID"", o.""EmployeeID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -504,7 +504,7 @@ public override async Task GroupBy_Dto_as_element_selector_Select_Sum(bool async await base.GroupBy_Dto_as_element_selector_Select_Sum(async); AssertSql( - @"SELECT COALESCE(SUM(o.""EmployeeID""::bigint), 0.0)::bigint AS ""Sum"", o.""CustomerID"" AS ""Key"" + @"SELECT COALESCE(sum(o.""EmployeeID""::bigint), 0.0)::bigint AS ""Sum"", o.""CustomerID"" AS ""Key"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -514,7 +514,7 @@ public override async Task GroupBy_Composite_Select_Dto_Sum_Min_Key_flattened_Ma await base.GroupBy_Composite_Select_Dto_Sum_Min_Key_flattened_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", o.""CustomerID"" AS ""CustomerId"", o.""EmployeeID"" AS ""EmployeeId"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", o.""CustomerID"" AS ""CustomerId"", o.""EmployeeID"" AS ""EmployeeId"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -524,7 +524,7 @@ public override async Task GroupBy_Composite_Select_Sum_Min_part_Key_flattened_M await base.GroupBy_Composite_Select_Sum_Min_part_Key_flattened_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", o.""CustomerID"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", o.""CustomerID"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"", o.""EmployeeID"""); } @@ -534,7 +534,7 @@ public override async Task GroupBy_Constant_Select_Sum_Min_Key_Max_Avg(bool asyn await base.GroupBy_Constant_Select_Sum_Min_Key_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"", MIN(t.""OrderID"") AS ""Min"", t.""Key"", MAX(t.""OrderID"") AS ""Max"", AVG(t.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"", min(t.""OrderID"") AS ""Min"", t.""Key"", max(t.""OrderID"") AS ""Max"", avg(t.""OrderID""::double precision) AS ""Avg"" FROM ( SELECT o.""OrderID"", 2 AS ""Key"" FROM ""Orders"" AS o @@ -547,7 +547,7 @@ public override async Task GroupBy_Constant_with_element_selector_Select_Sum(boo await base.GroupBy_Constant_with_element_selector_Select_Sum(async); AssertSql( - @"SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"" + @"SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"" FROM ( SELECT o.""OrderID"", 2 AS ""Key"" FROM ""Orders"" AS o @@ -560,7 +560,7 @@ public override async Task GroupBy_Constant_with_element_selector_Select_Sum2(bo await base.GroupBy_Constant_with_element_selector_Select_Sum2(async); AssertSql( - @"SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"" + @"SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"" FROM ( SELECT o.""OrderID"", 2 AS ""Key"" FROM ""Orders"" AS o @@ -573,7 +573,7 @@ public override async Task GroupBy_Constant_with_element_selector_Select_Sum3(bo await base.GroupBy_Constant_with_element_selector_Select_Sum3(async); AssertSql( - @"SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"" + @"SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"" FROM ( SELECT o.""OrderID"", 2 AS ""Key"" FROM ""Orders"" AS o @@ -586,7 +586,7 @@ public override async Task GroupBy_after_predicate_Constant_Select_Sum_Min_Key_M await base.GroupBy_after_predicate_Constant_Select_Sum_Min_Key_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"", MIN(t.""OrderID"") AS ""Min"", t.""Key"" AS ""Random"", MAX(t.""OrderID"") AS ""Max"", AVG(t.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"", min(t.""OrderID"") AS ""Min"", t.""Key"" AS ""Random"", max(t.""OrderID"") AS ""Max"", avg(t.""OrderID""::double precision) AS ""Avg"" FROM ( SELECT o.""OrderID"", 2 AS ""Key"" FROM ""Orders"" AS o @@ -600,7 +600,7 @@ public override async Task GroupBy_Constant_with_element_selector_Select_Sum_Min await base.GroupBy_Constant_with_element_selector_Select_Sum_Min_Key_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"", t.""Key"" + @"SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"", t.""Key"" FROM ( SELECT o.""OrderID"", 2 AS ""Key"" FROM ""Orders"" AS o @@ -613,7 +613,7 @@ public override async Task GroupBy_constant_with_where_on_grouping_with_aggregat await base.GroupBy_constant_with_where_on_grouping_with_aggregate_operators(async); AssertSql( - @"SELECT MIN(t.""OrderDate"") FILTER (WHERE 1 = t.""Key"") AS ""Min"", MAX(t.""OrderDate"") FILTER (WHERE 1 = t.""Key"") AS ""Max"", COALESCE(SUM(t.""OrderID"") FILTER (WHERE 1 = t.""Key""), 0)::INT AS ""Sum"", AVG(t.""OrderID""::double precision) FILTER (WHERE 1 = t.""Key"") AS ""Average"" + @"SELECT min(t.""OrderDate"") FILTER (WHERE 1 = t.""Key"") AS ""Min"", max(t.""OrderDate"") FILTER (WHERE 1 = t.""Key"") AS ""Max"", COALESCE(sum(t.""OrderID"") FILTER (WHERE 1 = t.""Key""), 0)::int AS ""Sum"", avg(t.""OrderID""::double precision) FILTER (WHERE 1 = t.""Key"") AS ""Average"" FROM ( SELECT o.""OrderID"", o.""OrderDate"", 1 AS ""Key"" FROM ""Orders"" AS o @@ -629,7 +629,7 @@ public override async Task GroupBy_param_Select_Sum_Min_Key_Max_Avg(bool async) AssertSql( @"@__a_0='2' -SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"", MIN(t.""OrderID"") AS ""Min"", t.""Key"", MAX(t.""OrderID"") AS ""Max"", AVG(t.""OrderID""::double precision) AS ""Avg"" +SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"", min(t.""OrderID"") AS ""Min"", t.""Key"", max(t.""OrderID"") AS ""Max"", avg(t.""OrderID""::double precision) AS ""Avg"" FROM ( SELECT o.""OrderID"", @__a_0 AS ""Key"" FROM ""Orders"" AS o @@ -644,7 +644,7 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum(bool a AssertSql( @"@__a_0='2' -SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"" +SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"" FROM ( SELECT o.""OrderID"", @__a_0 AS ""Key"" FROM ""Orders"" AS o @@ -659,7 +659,7 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum2(bool AssertSql( @"@__a_0='2' -SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"" +SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"" FROM ( SELECT o.""OrderID"", @__a_0 AS ""Key"" FROM ""Orders"" AS o @@ -674,7 +674,7 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum3(bool AssertSql( @"@__a_0='2' -SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"" +SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"" FROM ( SELECT o.""OrderID"", @__a_0 AS ""Key"" FROM ""Orders"" AS o @@ -689,7 +689,7 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum_Min_Ke AssertSql( @"@__a_0='2' -SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"", t.""Key"" +SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"", t.""Key"" FROM ( SELECT o.""OrderID"", @__a_0 AS ""Key"" FROM ""Orders"" AS o @@ -702,9 +702,9 @@ public override async Task GroupBy_anonymous_key_type_mismatch_with_aggregate(bo await base.GroupBy_anonymous_key_type_mismatch_with_aggregate(async); AssertSql( - @"SELECT COUNT(*)::INT AS ""I0"", t.""I0"" AS ""I1"" + @"SELECT count(*)::int AS ""I0"", t.""I0"" AS ""I1"" FROM ( - SELECT date_part('year', o.""OrderDate"")::INT AS ""I0"" + SELECT date_part('year', o.""OrderDate"")::int AS ""I0"" FROM ""Orders"" AS o ) AS t GROUP BY t.""I0"" @@ -716,7 +716,7 @@ public override async Task GroupBy_Property_scalar_element_selector_Average(bool await base.GroupBy_Property_scalar_element_selector_Average(async); AssertSql( - @"SELECT AVG(o.""OrderID""::double precision) + @"SELECT avg(o.""OrderID""::double precision) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -726,7 +726,7 @@ public override async Task GroupBy_Property_scalar_element_selector_Count(bool a await base.GroupBy_Property_scalar_element_selector_Count(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -736,7 +736,7 @@ public override async Task GroupBy_Property_scalar_element_selector_LongCount(bo await base.GroupBy_Property_scalar_element_selector_LongCount(async); AssertSql( - @"SELECT COUNT(*) + @"SELECT count(*) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -746,7 +746,7 @@ public override async Task GroupBy_Property_scalar_element_selector_Max(bool asy await base.GroupBy_Property_scalar_element_selector_Max(async); AssertSql( - @"SELECT MAX(o.""OrderID"") + @"SELECT max(o.""OrderID"") FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -756,7 +756,7 @@ public override async Task GroupBy_Property_scalar_element_selector_Min(bool asy await base.GroupBy_Property_scalar_element_selector_Min(async); AssertSql( - @"SELECT MIN(o.""OrderID"") + @"SELECT min(o.""OrderID"") FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -766,7 +766,7 @@ public override async Task GroupBy_Property_scalar_element_selector_Sum(bool asy await base.GroupBy_Property_scalar_element_selector_Sum(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -776,7 +776,7 @@ public override async Task GroupBy_Property_scalar_element_selector_Sum_Min_Max_ await base.GroupBy_Property_scalar_element_selector_Sum_Min_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -786,7 +786,7 @@ public override async Task GroupBy_Property_anonymous_element_selector_Average(b await base.GroupBy_Property_anonymous_element_selector_Average(async); AssertSql( - @"SELECT AVG(o.""OrderID""::double precision) + @"SELECT avg(o.""OrderID""::double precision) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -796,7 +796,7 @@ public override async Task GroupBy_Property_anonymous_element_selector_Count(boo await base.GroupBy_Property_anonymous_element_selector_Count(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -806,7 +806,7 @@ public override async Task GroupBy_Property_anonymous_element_selector_LongCount await base.GroupBy_Property_anonymous_element_selector_LongCount(async); AssertSql( - @"SELECT COUNT(*) + @"SELECT count(*) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -816,7 +816,7 @@ public override async Task GroupBy_Property_anonymous_element_selector_Max(bool await base.GroupBy_Property_anonymous_element_selector_Max(async); AssertSql( - @"SELECT MAX(o.""OrderID"") + @"SELECT max(o.""OrderID"") FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -826,7 +826,7 @@ public override async Task GroupBy_Property_anonymous_element_selector_Min(bool await base.GroupBy_Property_anonymous_element_selector_Min(async); AssertSql( - @"SELECT MIN(o.""OrderID"") + @"SELECT min(o.""OrderID"") FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -836,7 +836,7 @@ public override async Task GroupBy_Property_anonymous_element_selector_Sum(bool await base.GroupBy_Property_anonymous_element_selector_Sum(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -846,7 +846,7 @@ public override async Task GroupBy_Property_anonymous_element_selector_Sum_Min_M await base.GroupBy_Property_anonymous_element_selector_Sum_Min_Max_Avg(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""EmployeeID"") AS ""Min"", MAX(o.""EmployeeID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""EmployeeID"") AS ""Min"", max(o.""EmployeeID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -856,7 +856,7 @@ public override async Task GroupBy_element_selector_complex_aggregate(bool async await base.GroupBy_element_selector_complex_aggregate(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID"" + 1), 0)::INT + @"SELECT COALESCE(sum(o.""OrderID"" + 1), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -866,7 +866,7 @@ public override async Task GroupBy_element_selector_complex_aggregate2(bool asyn await base.GroupBy_element_selector_complex_aggregate2(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID"" + 1), 0)::INT + @"SELECT COALESCE(sum(o.""OrderID"" + 1), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -876,7 +876,7 @@ public override async Task GroupBy_element_selector_complex_aggregate3(bool asyn await base.GroupBy_element_selector_complex_aggregate3(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID"" + 1), 0)::INT + @"SELECT COALESCE(sum(o.""OrderID"" + 1), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -886,7 +886,7 @@ public override async Task GroupBy_element_selector_complex_aggregate4(bool asyn await base.GroupBy_element_selector_complex_aggregate4(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID"" + 1), 0)::INT + @"SELECT COALESCE(sum(o.""OrderID"" + 1), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -896,7 +896,7 @@ public override async Task Element_selector_with_case_block_repeated_inside_anot await base.Element_selector_with_case_block_repeated_inside_another_case_block_in_projection(async); AssertSql( - @"SELECT o.""OrderID"", COALESCE(SUM(CASE + @"SELECT o.""OrderID"", COALESCE(sum(CASE WHEN o.""CustomerID"" = 'ALFKI' THEN CASE WHEN o.""OrderID"" > 1000 THEN o.""OrderID"" ELSE -o.""OrderID"" @@ -905,7 +905,7 @@ WHEN o.""OrderID"" > 1000 THEN o.""OrderID"" WHEN o.""OrderID"" > 1000 THEN o.""OrderID"" ELSE -o.""OrderID"" END -END), 0)::INT AS ""Aggregate"" +END), 0)::int AS ""Aggregate"" FROM ""Orders"" AS o GROUP BY o.""OrderID"""); } @@ -915,7 +915,7 @@ public override async Task GroupBy_conditional_properties(bool async) await base.GroupBy_conditional_properties(async); AssertSql( - @"SELECT t.""OrderMonth"", t.""CustomerID"" AS ""Customer"", COUNT(*)::INT AS ""Count"" + @"SELECT t.""OrderMonth"", t.""CustomerID"" AS ""Customer"", count(*)::int AS ""Count"" FROM ( SELECT o.""CustomerID"", NULL AS ""OrderMonth"" FROM ""Orders"" AS o @@ -928,7 +928,7 @@ public override async Task GroupBy_empty_key_Aggregate(bool async) await base.GroupBy_empty_key_Aggregate(async); AssertSql( - @"SELECT COALESCE(SUM(t.""OrderID""), 0)::INT + @"SELECT COALESCE(sum(t.""OrderID""), 0)::int FROM ( SELECT o.""OrderID"", 1 AS ""Key"" FROM ""Orders"" AS o @@ -941,7 +941,7 @@ public override async Task GroupBy_empty_key_Aggregate_Key(bool async) await base.GroupBy_empty_key_Aggregate_Key(async); AssertSql( - @"SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"" + @"SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"" FROM ( SELECT o.""OrderID"", 1 AS ""Key"" FROM ""Orders"" AS o @@ -954,7 +954,7 @@ public override async Task OrderBy_GroupBy_Aggregate(bool async) await base.OrderBy_GroupBy_Aggregate(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -966,7 +966,7 @@ public override async Task OrderBy_Skip_GroupBy_Aggregate(bool async) AssertSql( @"@__p_0='80' -SELECT AVG(t.""OrderID""::double precision) +SELECT avg(t.""OrderID""::double precision) FROM ( SELECT o.""OrderID"", o.""CustomerID"" FROM ""Orders"" AS o @@ -983,7 +983,7 @@ public override async Task OrderBy_Take_GroupBy_Aggregate(bool async) AssertSql( @"@__p_0='500' -SELECT MIN(t.""OrderID"") +SELECT min(t.""OrderID"") FROM ( SELECT o.""OrderID"", o.""CustomerID"" FROM ""Orders"" AS o @@ -1001,7 +1001,7 @@ public override async Task OrderBy_Skip_Take_GroupBy_Aggregate(bool async) @"@__p_1='500' @__p_0='80' -SELECT MAX(t.""OrderID"") +SELECT max(t.""OrderID"") FROM ( SELECT o.""OrderID"", o.""CustomerID"" FROM ""Orders"" AS o @@ -1016,7 +1016,7 @@ public override async Task Distinct_GroupBy_Aggregate(bool async) await base.Distinct_GroupBy_Aggregate(async); AssertSql( - @"SELECT t.""CustomerID"" AS ""Key"", COUNT(*)::INT AS c + @"SELECT t.""CustomerID"" AS ""Key"", count(*)::int AS c FROM ( SELECT DISTINCT o.""OrderID"", o.""CustomerID"", o.""EmployeeID"", o.""OrderDate"" FROM ""Orders"" AS o @@ -1029,7 +1029,7 @@ public override async Task Anonymous_projection_Distinct_GroupBy_Aggregate(bool await base.Anonymous_projection_Distinct_GroupBy_Aggregate(async); AssertSql( - @"SELECT t.""EmployeeID"" AS ""Key"", COUNT(*)::INT AS c + @"SELECT t.""EmployeeID"" AS ""Key"", count(*)::int AS c FROM ( SELECT DISTINCT o.""OrderID"", o.""EmployeeID"" FROM ""Orders"" AS o @@ -1042,7 +1042,7 @@ public override async Task SelectMany_GroupBy_Aggregate(bool async) await base.SelectMany_GroupBy_Aggregate(async); AssertSql( - @"SELECT o.""EmployeeID"" AS ""Key"", COUNT(*)::INT AS c + @"SELECT o.""EmployeeID"" AS ""Key"", count(*)::int AS c FROM ""Customers"" AS c INNER JOIN ""Orders"" AS o ON c.""CustomerID"" = o.""CustomerID"" GROUP BY o.""EmployeeID"""); @@ -1053,7 +1053,7 @@ public override async Task Join_GroupBy_Aggregate(bool async) await base.Join_GroupBy_Aggregate(async); AssertSql( - @"SELECT c.""CustomerID"" AS ""Key"", AVG(o.""OrderID""::double precision) AS ""Count"" + @"SELECT c.""CustomerID"" AS ""Key"", avg(o.""OrderID""::double precision) AS ""Count"" FROM ""Orders"" AS o INNER JOIN ""Customers"" AS c ON o.""CustomerID"" = c.""CustomerID"" GROUP BY c.""CustomerID"""); @@ -1064,7 +1064,7 @@ public override async Task GroupBy_required_navigation_member_Aggregate(bool asy await base.GroupBy_required_navigation_member_Aggregate(async); AssertSql( - @"SELECT o0.""CustomerID"" AS ""CustomerId"", COUNT(*)::INT AS ""Count"" + @"SELECT o0.""CustomerID"" AS ""CustomerId"", count(*)::int AS ""Count"" FROM ""Order Details"" AS o INNER JOIN ""Orders"" AS o0 ON o.""OrderID"" = o0.""OrderID"" GROUP BY o0.""CustomerID"""); @@ -1079,7 +1079,7 @@ public override async Task Join_complex_GroupBy_Aggregate(bool async) @__p_2='50' @__p_1='10' -SELECT t0.""CustomerID"" AS ""Key"", AVG(t.""OrderID""::double precision) AS ""Count"" +SELECT t0.""CustomerID"" AS ""Key"", avg(t.""OrderID""::double precision) AS ""Count"" FROM ( SELECT o.""OrderID"", o.""CustomerID"" FROM ""Orders"" AS o @@ -1102,7 +1102,7 @@ public override async Task GroupJoin_GroupBy_Aggregate(bool async) await base.GroupJoin_GroupBy_Aggregate(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", AVG(o.""OrderID""::double precision) AS ""Average"" + @"SELECT o.""CustomerID"" AS ""Key"", avg(o.""OrderID""::double precision) AS ""Average"" FROM ""Customers"" AS c LEFT JOIN ""Orders"" AS o ON c.""CustomerID"" = o.""CustomerID"" WHERE (o.""OrderID"" IS NOT NULL) @@ -1114,7 +1114,7 @@ public override async Task GroupJoin_GroupBy_Aggregate_2(bool async) await base.GroupJoin_GroupBy_Aggregate_2(async); AssertSql( - @"SELECT c.""CustomerID"" AS ""Key"", MAX(c.""City"") AS ""Max"" + @"SELECT c.""CustomerID"" AS ""Key"", max(c.""City"") AS ""Max"" FROM ""Customers"" AS c LEFT JOIN ""Orders"" AS o ON c.""CustomerID"" = o.""CustomerID"" GROUP BY c.""CustomerID"""); @@ -1125,7 +1125,7 @@ public override async Task GroupJoin_GroupBy_Aggregate_3(bool async) await base.GroupJoin_GroupBy_Aggregate_3(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", AVG(o.""OrderID""::double precision) AS ""Average"" + @"SELECT o.""CustomerID"" AS ""Key"", avg(o.""OrderID""::double precision) AS ""Average"" FROM ""Orders"" AS o LEFT JOIN ""Customers"" AS c ON o.""CustomerID"" = c.""CustomerID"" GROUP BY o.""CustomerID"""); @@ -1136,7 +1136,7 @@ public override async Task GroupJoin_GroupBy_Aggregate_4(bool async) await base.GroupJoin_GroupBy_Aggregate_4(async); AssertSql( - @"SELECT c.""CustomerID"" AS ""Value"", MAX(c.""City"") AS ""Max"" + @"SELECT c.""CustomerID"" AS ""Value"", max(c.""City"") AS ""Max"" FROM ""Customers"" AS c LEFT JOIN ""Orders"" AS o ON c.""CustomerID"" = o.""CustomerID"" GROUP BY c.""CustomerID"""); @@ -1147,7 +1147,7 @@ public override async Task GroupJoin_GroupBy_Aggregate_5(bool async) await base.GroupJoin_GroupBy_Aggregate_5(async); AssertSql( - @"SELECT o.""OrderID"" AS ""Value"", AVG(o.""OrderID""::double precision) AS ""Average"" + @"SELECT o.""OrderID"" AS ""Value"", avg(o.""OrderID""::double precision) AS ""Average"" FROM ""Orders"" AS o LEFT JOIN ""Customers"" AS c ON o.""CustomerID"" = c.""CustomerID"" GROUP BY o.""OrderID"""); @@ -1158,7 +1158,7 @@ public override async Task GroupBy_optional_navigation_member_Aggregate(bool asy await base.GroupBy_optional_navigation_member_Aggregate(async); AssertSql( - @"SELECT c.""Country"", COUNT(*)::INT AS ""Count"" + @"SELECT c.""Country"", count(*)::int AS ""Count"" FROM ""Orders"" AS o LEFT JOIN ""Customers"" AS c ON o.""CustomerID"" = c.""CustomerID"" GROUP BY c.""Country"""); @@ -1173,7 +1173,7 @@ public override async Task GroupJoin_complex_GroupBy_Aggregate(bool async) @__p_0='10' @__p_2='100' -SELECT t0.""CustomerID"" AS ""Key"", AVG(t0.""OrderID""::double precision) AS ""Count"" +SELECT t0.""CustomerID"" AS ""Key"", avg(t0.""OrderID""::double precision) AS ""Count"" FROM ( SELECT c.""CustomerID"" FROM ""Customers"" AS c @@ -1197,7 +1197,7 @@ public override async Task Self_join_GroupBy_Aggregate(bool async) await base.Self_join_GroupBy_Aggregate(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", AVG(o0.""OrderID""::double precision) AS ""Count"" + @"SELECT o.""CustomerID"" AS ""Key"", avg(o0.""OrderID""::double precision) AS ""Count"" FROM ""Orders"" AS o INNER JOIN ""Orders"" AS o0 ON o.""OrderID"" = o0.""OrderID"" WHERE o.""OrderID"" < 10400 @@ -1209,7 +1209,7 @@ public override async Task GroupBy_multi_navigation_members_Aggregate(bool async await base.GroupBy_multi_navigation_members_Aggregate(async); AssertSql( - @"SELECT o0.""CustomerID"", p.""ProductName"", COUNT(*)::INT AS ""Count"" + @"SELECT o0.""CustomerID"", p.""ProductName"", count(*)::int AS ""Count"" FROM ""Order Details"" AS o INNER JOIN ""Orders"" AS o0 ON o.""OrderID"" = o0.""OrderID"" INNER JOIN ""Products"" AS p ON o.""ProductID"" = p.""ProductID"" @@ -1221,7 +1221,7 @@ public override async Task Union_simple_groupby(bool async) await base.Union_simple_groupby(async); AssertSql( - @"SELECT t.""City"" AS ""Key"", COUNT(*)::INT AS ""Total"" + @"SELECT t.""City"" AS ""Key"", count(*)::int AS ""Total"" FROM ( SELECT c.""CustomerID"", c.""Address"", c.""City"", c.""CompanyName"", c.""ContactName"", c.""ContactTitle"", c.""Country"", c.""Fax"", c.""Phone"", c.""PostalCode"", c.""Region"" FROM ""Customers"" AS c @@ -1239,7 +1239,7 @@ public override async Task Select_anonymous_GroupBy_Aggregate(bool async) await base.Select_anonymous_GroupBy_Aggregate(async); AssertSql( - @"SELECT MIN(o.""OrderDate"") AS ""Min"", MAX(o.""OrderDate"") AS ""Max"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT min(o.""OrderDate"") AS ""Min"", max(o.""OrderDate"") AS ""Max"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o WHERE o.""OrderID"" < 10300 GROUP BY o.""CustomerID"""); @@ -1250,7 +1250,7 @@ public override async Task GroupBy_principal_key_property_optimization(bool asyn await base.GroupBy_principal_key_property_optimization(async); AssertSql( - @"SELECT c.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT c.""CustomerID"" AS ""Key"", count(*)::int AS ""Count"" FROM ""Orders"" AS o LEFT JOIN ""Customers"" AS c ON o.""CustomerID"" = c.""CustomerID"" GROUP BY c.""CustomerID"""); @@ -1261,7 +1261,7 @@ public override async Task GroupBy_after_anonymous_projection_and_distinct_follo await base.GroupBy_after_anonymous_projection_and_distinct_followed_by_another_anonymous_projection(async); AssertSql( - @"SELECT t.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT t.""CustomerID"" AS ""Key"", count(*)::int AS ""Count"" FROM ( SELECT DISTINCT o.""CustomerID"", o.""OrderID"" FROM ""Orders"" AS o @@ -1274,7 +1274,7 @@ public override async Task GroupBy_complex_key_aggregate(bool async) await base.GroupBy_complex_key_aggregate(async); AssertSql( - @"SELECT t.""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT t.""Key"", count(*)::int AS ""Count"" FROM ( SELECT substring(c.""CustomerID"", 1, 1) AS ""Key"" FROM ""Orders"" AS o @@ -1288,12 +1288,12 @@ public override async Task GroupBy_complex_key_aggregate_2(bool async) await base.GroupBy_complex_key_aggregate_2(async); AssertSql( - @"SELECT t.""Key"" AS ""Month"", COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Total"", ( - SELECT COALESCE(SUM(o0.""OrderID""), 0)::INT + @"SELECT t.""Key"" AS ""Month"", COALESCE(sum(t.""OrderID""), 0)::int AS ""Total"", ( + SELECT COALESCE(sum(o0.""OrderID""), 0)::int FROM ""Orders"" AS o0 - WHERE date_part('month', o0.""OrderDate"")::INT = t.""Key"" OR ((o0.""OrderDate"" IS NULL) AND (t.""Key"" IS NULL))) AS ""Payment"" + WHERE date_part('month', o0.""OrderDate"")::int = t.""Key"" OR ((o0.""OrderDate"" IS NULL) AND (t.""Key"" IS NULL))) AS ""Payment"" FROM ( - SELECT o.""OrderID"", date_part('month', o.""OrderDate"")::INT AS ""Key"" + SELECT o.""OrderID"", date_part('month', o.""OrderDate"")::int AS ""Key"" FROM ""Orders"" AS o ) AS t GROUP BY t.""Key"""); @@ -1304,7 +1304,7 @@ public override async Task Select_collection_of_scalar_before_GroupBy_aggregate( await base.Select_collection_of_scalar_before_GroupBy_aggregate(async); AssertSql( - @"SELECT c.""City"" AS ""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT c.""City"" AS ""Key"", count(*)::int AS ""Count"" FROM ""Customers"" AS c GROUP BY c.""City"""); } @@ -1314,7 +1314,7 @@ public override async Task GroupBy_OrderBy_key(bool async) await base.GroupBy_OrderBy_key(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COUNT(*)::INT AS c + @"SELECT o.""CustomerID"" AS ""Key"", count(*)::int AS c FROM ""Orders"" AS o GROUP BY o.""CustomerID"" ORDER BY o.""CustomerID"" NULLS FIRST"); @@ -1325,10 +1325,10 @@ public override async Task GroupBy_OrderBy_count(bool async) await base.GroupBy_OrderBy_count(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT o.""CustomerID"" AS ""Key"", count(*)::int AS ""Count"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" -ORDER BY COUNT(*)::INT NULLS FIRST, o.""CustomerID"" NULLS FIRST"); +ORDER BY count(*)::int NULLS FIRST, o.""CustomerID"" NULLS FIRST"); } public override async Task GroupBy_OrderBy_count_Select_sum(bool async) @@ -1336,10 +1336,10 @@ public override async Task GroupBy_OrderBy_count_Select_sum(bool async) await base.GroupBy_OrderBy_count_Select_sum(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"" + @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" -ORDER BY COUNT(*)::INT NULLS FIRST, o.""CustomerID"" NULLS FIRST"); +ORDER BY count(*)::int NULLS FIRST, o.""CustomerID"" NULLS FIRST"); } public override async Task GroupBy_aggregate_Contains(bool async) @@ -1353,7 +1353,7 @@ WHERE EXISTS ( SELECT 1 FROM ""Orders"" AS o0 GROUP BY o0.""CustomerID"" - HAVING COUNT(*)::INT > 30 AND (o0.""CustomerID"" = o.""CustomerID"" OR ((o0.""CustomerID"" IS NULL) AND (o.""CustomerID"" IS NULL))))"); + HAVING count(*)::int > 30 AND (o0.""CustomerID"" = o.""CustomerID"" OR ((o0.""CustomerID"" IS NULL) AND (o.""CustomerID"" IS NULL))))"); } public override async Task GroupBy_aggregate_Pushdown(bool async) @@ -1369,7 +1369,7 @@ SELECT t.""CustomerID"" SELECT o.""CustomerID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 10 + HAVING count(*)::int > 10 ORDER BY o.""CustomerID"" NULLS FIRST LIMIT @__p_0 ) AS t @@ -1387,10 +1387,10 @@ public override async Task GroupBy_aggregate_using_grouping_key_Pushdown(bool as SELECT t.""Key"", t.""Max"" FROM ( - SELECT o.""CustomerID"" AS ""Key"", MAX(o.""CustomerID"") AS ""Max"" + SELECT o.""CustomerID"" AS ""Key"", max(o.""CustomerID"") AS ""Max"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 10 + HAVING count(*)::int > 10 ORDER BY o.""CustomerID"" NULLS FIRST LIMIT @__p_0 ) AS t @@ -1406,12 +1406,12 @@ public override async Task GroupBy_aggregate_Pushdown_followed_by_projecting_Len @"@__p_0='20' @__p_1='4' -SELECT length(t.""CustomerID"")::INT +SELECT length(t.""CustomerID"")::int FROM ( SELECT o.""CustomerID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 10 + HAVING count(*)::int > 10 ORDER BY o.""CustomerID"" NULLS FIRST LIMIT @__p_0 ) AS t @@ -1432,7 +1432,7 @@ SELECT 5 SELECT o.""CustomerID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 10 + HAVING count(*)::int > 10 ORDER BY o.""CustomerID"" NULLS FIRST LIMIT @__p_0 ) AS t @@ -1445,7 +1445,7 @@ public override async Task GroupBy_filter_key(bool async) await base.GroupBy_filter_key(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COUNT(*)::INT AS c + @"SELECT o.""CustomerID"" AS ""Key"", count(*)::int AS c FROM ""Orders"" AS o GROUP BY o.""CustomerID"" HAVING o.""CustomerID"" = 'ALFKI'"); @@ -1456,10 +1456,10 @@ public override async Task GroupBy_filter_count(bool async) await base.GroupBy_filter_count(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT o.""CustomerID"" AS ""Key"", count(*)::int AS ""Count"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" -HAVING COUNT(*)::INT > 4"); +HAVING count(*)::int > 4"); } public override async Task GroupBy_count_filter(bool async) @@ -1467,13 +1467,13 @@ public override async Task GroupBy_count_filter(bool async) await base.GroupBy_count_filter(async); AssertSql( - @"SELECT t.""Key"" AS ""Name"", COUNT(*)::INT AS ""Count"" + @"SELECT t.""Key"" AS ""Name"", count(*)::int AS ""Count"" FROM ( SELECT 'Order' AS ""Key"" FROM ""Orders"" AS o ) AS t GROUP BY t.""Key"" -HAVING COUNT(*)::INT > 0"); +HAVING count(*)::int > 0"); } public override async Task GroupBy_filter_count_OrderBy_count_Select_sum(bool async) @@ -1481,11 +1481,11 @@ public override async Task GroupBy_filter_count_OrderBy_count_Select_sum(bool as await base.GroupBy_filter_count_OrderBy_count_Select_sum(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Count"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"" + @"SELECT o.""CustomerID"" AS ""Key"", count(*)::int AS ""Count"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" -HAVING COUNT(*)::INT > 4 -ORDER BY COUNT(*)::INT NULLS FIRST, o.""CustomerID"" NULLS FIRST"); +HAVING count(*)::int > 4 +ORDER BY count(*)::int NULLS FIRST, o.""CustomerID"" NULLS FIRST"); } public override async Task GroupBy_Aggregate_Join(bool async) @@ -1495,10 +1495,10 @@ public override async Task GroupBy_Aggregate_Join(bool async) AssertSql( @"SELECT c.""CustomerID"", c.""Address"", c.""City"", c.""CompanyName"", c.""ContactName"", c.""ContactTitle"", c.""Country"", c.""Fax"", c.""Phone"", c.""PostalCode"", c.""Region"", o0.""OrderID"", o0.""CustomerID"", o0.""EmployeeID"", o0.""OrderDate"" FROM ( - SELECT o.""CustomerID"", MAX(o.""OrderID"") AS ""LastOrderID"" + SELECT o.""CustomerID"", max(o.""OrderID"") AS ""LastOrderID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 5 + HAVING count(*)::int > 5 ) AS t INNER JOIN ""Customers"" AS c ON t.""CustomerID"" = c.""CustomerID"" INNER JOIN ""Orders"" AS o0 ON t.""LastOrderID"" = o0.""OrderID"""); @@ -1515,7 +1515,7 @@ INNER JOIN ( SELECT o.""CustomerID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 5 + HAVING count(*)::int > 5 ) AS t ON c.""CustomerID"" = t.""CustomerID"""); } @@ -1527,10 +1527,10 @@ public override async Task GroupBy_Aggregate_LeftJoin_converted_from_SelectMany( @"SELECT c.""CustomerID"", c.""Address"", c.""City"", c.""CompanyName"", c.""ContactName"", c.""ContactTitle"", c.""Country"", c.""Fax"", c.""Phone"", c.""PostalCode"", c.""Region"" FROM ""Customers"" AS c LEFT JOIN ( - SELECT o.""CustomerID"", MAX(o.""OrderID"") AS ""LastOrderID"" + SELECT o.""CustomerID"", max(o.""OrderID"") AS ""LastOrderID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 5 + HAVING count(*)::int > 5 ) AS t ON c.""CustomerID"" = t.""CustomerID"""); } @@ -1542,10 +1542,10 @@ public override async Task Join_GroupBy_Aggregate_multijoins(bool async) @"SELECT c.""CustomerID"", c.""Address"", c.""City"", c.""CompanyName"", c.""ContactName"", c.""ContactTitle"", c.""Country"", c.""Fax"", c.""Phone"", c.""PostalCode"", c.""Region"", o0.""OrderID"", o0.""CustomerID"", o0.""EmployeeID"", o0.""OrderDate"" FROM ""Customers"" AS c INNER JOIN ( - SELECT o.""CustomerID"", MAX(o.""OrderID"") AS ""LastOrderID"" + SELECT o.""CustomerID"", max(o.""OrderID"") AS ""LastOrderID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 5 + HAVING count(*)::int > 5 ) AS t ON c.""CustomerID"" = t.""CustomerID"" INNER JOIN ""Orders"" AS o0 ON t.""LastOrderID"" = o0.""OrderID"""); } @@ -1558,10 +1558,10 @@ public override async Task Join_GroupBy_Aggregate_single_join(bool async) @"SELECT c.""CustomerID"", c.""Address"", c.""City"", c.""CompanyName"", c.""ContactName"", c.""ContactTitle"", c.""Country"", c.""Fax"", c.""Phone"", c.""PostalCode"", c.""Region"", t.""LastOrderID"" FROM ""Customers"" AS c INNER JOIN ( - SELECT o.""CustomerID"", MAX(o.""OrderID"") AS ""LastOrderID"" + SELECT o.""CustomerID"", max(o.""OrderID"") AS ""LastOrderID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 5 + HAVING count(*)::int > 5 ) AS t ON c.""CustomerID"" = t.""CustomerID"""); } @@ -1573,10 +1573,10 @@ public override async Task Join_GroupBy_Aggregate_with_another_join(bool async) @"SELECT c.""CustomerID"", c.""Address"", c.""City"", c.""CompanyName"", c.""ContactName"", c.""ContactTitle"", c.""Country"", c.""Fax"", c.""Phone"", c.""PostalCode"", c.""Region"", t.""LastOrderID"", o0.""OrderID"" FROM ""Customers"" AS c INNER JOIN ( - SELECT o.""CustomerID"", MAX(o.""OrderID"") AS ""LastOrderID"" + SELECT o.""CustomerID"", max(o.""OrderID"") AS ""LastOrderID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 5 + HAVING count(*)::int > 5 ) AS t ON c.""CustomerID"" = t.""CustomerID"" INNER JOIN ""Orders"" AS o0 ON c.""CustomerID"" = o0.""CustomerID"""); } @@ -1589,13 +1589,13 @@ public override async Task Join_GroupBy_Aggregate_distinct_single_join(bool asyn @"SELECT c.""CustomerID"", c.""Address"", c.""City"", c.""CompanyName"", c.""ContactName"", c.""ContactTitle"", c.""Country"", c.""Fax"", c.""Phone"", c.""PostalCode"", c.""Region"", t0.""LastOrderID"" FROM ""Customers"" AS c INNER JOIN ( - SELECT DISTINCT t.""CustomerID"", MAX(t.""OrderID"") AS ""LastOrderID"" + SELECT DISTINCT t.""CustomerID"", max(t.""OrderID"") AS ""LastOrderID"" FROM ( - SELECT o.""OrderID"", o.""CustomerID"", date_part('year', o.""OrderDate"")::INT AS ""Year"" + SELECT o.""OrderID"", o.""CustomerID"", date_part('year', o.""OrderDate"")::int AS ""Year"" FROM ""Orders"" AS o ) AS t GROUP BY t.""CustomerID"", t.""Year"" - HAVING COUNT(*)::INT > 5 + HAVING count(*)::int > 5 ) AS t0 ON c.""CustomerID"" = t0.""CustomerID"""); } @@ -1607,10 +1607,10 @@ public override async Task Join_GroupBy_Aggregate_with_left_join(bool async) @"SELECT c.""CustomerID"", c.""Address"", c.""City"", c.""CompanyName"", c.""ContactName"", c.""ContactTitle"", c.""Country"", c.""Fax"", c.""Phone"", c.""PostalCode"", c.""Region"", t.""LastOrderID"" FROM ""Customers"" AS c LEFT JOIN ( - SELECT o.""CustomerID"", MAX(o.""OrderID"") AS ""LastOrderID"" + SELECT o.""CustomerID"", max(o.""OrderID"") AS ""LastOrderID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 5 + HAVING count(*)::int > 5 ) AS t ON c.""CustomerID"" = t.""CustomerID"" WHERE c.""CustomerID"" LIKE 'A%'"); } @@ -1629,7 +1629,7 @@ INNER JOIN ( SELECT o0.""CustomerID"" FROM ""Orders"" AS o0 GROUP BY o0.""CustomerID"" - HAVING COUNT(*)::INT > 5 + HAVING count(*)::int > 5 ) AS t ON c.""CustomerID"" = t.""CustomerID"" ) AS t0 ON o.""CustomerID"" = t0.""CustomerID"" WHERE o.""OrderID"" < 10400"); @@ -1643,10 +1643,10 @@ public override async Task Join_GroupBy_Aggregate_on_key(bool async) @"SELECT c.""CustomerID"", c.""Address"", c.""City"", c.""CompanyName"", c.""ContactName"", c.""ContactTitle"", c.""Country"", c.""Fax"", c.""Phone"", c.""PostalCode"", c.""Region"", t.""LastOrderID"" FROM ""Customers"" AS c INNER JOIN ( - SELECT o.""CustomerID"" AS ""Key"", MAX(o.""OrderID"") AS ""LastOrderID"" + SELECT o.""CustomerID"" AS ""Key"", max(o.""OrderID"") AS ""LastOrderID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 5 + HAVING count(*)::int > 5 ) AS t ON c.""CustomerID"" = t.""Key"""); } @@ -1655,7 +1655,7 @@ public override async Task GroupBy_with_result_selector(bool async) await base.GroupBy_with_result_selector(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", MIN(o.""OrderID"") AS ""Min"", MAX(o.""OrderID"") AS ""Max"", AVG(o.""OrderID""::double precision) AS ""Avg"" + @"SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", min(o.""OrderID"") AS ""Min"", max(o.""OrderID"") AS ""Max"", avg(o.""OrderID""::double precision) AS ""Avg"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1665,7 +1665,7 @@ public override async Task GroupBy_Sum_constant(bool async) await base.GroupBy_Sum_constant(async); AssertSql( - @"SELECT COALESCE(SUM(1), 0)::INT + @"SELECT COALESCE(sum(1), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1675,7 +1675,7 @@ public override async Task GroupBy_Sum_constant_cast(bool async) await base.GroupBy_Sum_constant_cast(async); AssertSql( - @"SELECT COALESCE(SUM(1), 0.0)::bigint + @"SELECT COALESCE(sum(1), 0.0)::bigint FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1685,7 +1685,7 @@ public override async Task Distinct_GroupBy_OrderBy_key(bool async) await base.Distinct_GroupBy_OrderBy_key(async); AssertSql( - @"SELECT t.""CustomerID"" AS ""Key"", COUNT(*)::INT AS c + @"SELECT t.""CustomerID"" AS ""Key"", count(*)::int AS c FROM ( SELECT DISTINCT o.""OrderID"", o.""CustomerID"", o.""EmployeeID"", o.""OrderDate"" FROM ""Orders"" AS o @@ -1743,7 +1743,7 @@ SELECT p.""ProductID"" GROUP BY p.""ProductID"" ) AS t ON TRUE LEFT JOIN LATERAL ( - SELECT COUNT(*)::INT AS c, p0.""ProductID"" + SELECT count(*)::int AS c, p0.""ProductID"" FROM ""Products"" AS p0 GROUP BY p0.""ProductID"" ) AS t0 ON TRUE @@ -1768,7 +1768,7 @@ public override async Task GroupBy_Where_Average(bool async) await base.GroupBy_Where_Average(async); AssertSql( - @"SELECT AVG(o.""OrderID""::double precision) FILTER (WHERE o.""OrderID"" < 10300) + @"SELECT avg(o.""OrderID""::double precision) FILTER (WHERE o.""OrderID"" < 10300) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1778,7 +1778,7 @@ public override async Task GroupBy_Where_Count(bool async) await base.GroupBy_Where_Count(async); AssertSql( - @"SELECT COUNT(*) FILTER (WHERE o.""OrderID"" < 10300)::INT + @"SELECT count(*) FILTER (WHERE o.""OrderID"" < 10300)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1788,7 +1788,7 @@ public override async Task GroupBy_Where_LongCount(bool async) await base.GroupBy_Where_LongCount(async); AssertSql( - @"SELECT COUNT(*) FILTER (WHERE o.""OrderID"" < 10300) + @"SELECT count(*) FILTER (WHERE o.""OrderID"" < 10300) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1798,7 +1798,7 @@ public override async Task GroupBy_Where_Max(bool async) await base.GroupBy_Where_Max(async); AssertSql( - @"SELECT MAX(o.""OrderID"") FILTER (WHERE o.""OrderID"" < 10300) + @"SELECT max(o.""OrderID"") FILTER (WHERE o.""OrderID"" < 10300) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1808,7 +1808,7 @@ public override async Task GroupBy_Where_Min(bool async) await base.GroupBy_Where_Min(async); AssertSql( - @"SELECT MIN(o.""OrderID"") FILTER (WHERE o.""OrderID"" < 10300) + @"SELECT min(o.""OrderID"") FILTER (WHERE o.""OrderID"" < 10300) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1818,7 +1818,7 @@ public override async Task GroupBy_Where_Sum(bool async) await base.GroupBy_Where_Sum(async); AssertSql( - @"SELECT COALESCE(SUM(o.""OrderID"") FILTER (WHERE o.""OrderID"" < 10300), 0)::INT + @"SELECT COALESCE(sum(o.""OrderID"") FILTER (WHERE o.""OrderID"" < 10300), 0)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1828,7 +1828,7 @@ public override async Task GroupBy_Where_Count_with_predicate(bool async) await base.GroupBy_Where_Count_with_predicate(async); AssertSql( - @"SELECT COUNT(*) FILTER (WHERE o.""OrderID"" < 10300 AND (o.""OrderDate"" IS NOT NULL) AND date_part('year', o.""OrderDate"")::INT = 1997)::INT + @"SELECT count(*) FILTER (WHERE o.""OrderID"" < 10300 AND (o.""OrderDate"" IS NOT NULL) AND date_part('year', o.""OrderDate"")::int = 1997)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1838,7 +1838,7 @@ public override async Task GroupBy_Where_Where_Count(bool async) await base.GroupBy_Where_Where_Count(async); AssertSql( - @"SELECT COUNT(*) FILTER (WHERE o.""OrderID"" < 10300 AND (o.""OrderDate"" IS NOT NULL) AND date_part('year', o.""OrderDate"")::INT = 1997)::INT + @"SELECT count(*) FILTER (WHERE o.""OrderID"" < 10300 AND (o.""OrderDate"" IS NOT NULL) AND date_part('year', o.""OrderDate"")::int = 1997)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1848,7 +1848,7 @@ public override async Task GroupBy_Where_Select_Where_Count(bool async) await base.GroupBy_Where_Select_Where_Count(async); AssertSql( - @"SELECT COUNT(*) FILTER (WHERE o.""OrderID"" < 10300 AND (o.""OrderDate"" IS NOT NULL) AND date_part('year', o.""OrderDate"")::INT = 1997)::INT + @"SELECT count(*) FILTER (WHERE o.""OrderID"" < 10300 AND (o.""OrderDate"" IS NOT NULL) AND date_part('year', o.""OrderDate"")::int = 1997)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1858,7 +1858,7 @@ public override async Task GroupBy_Where_Select_Where_Select_Min(bool async) await base.GroupBy_Where_Select_Where_Select_Min(async); AssertSql( - @"SELECT MIN(o.""OrderID"") FILTER (WHERE o.""OrderID"" < 10300 AND (o.""OrderDate"" IS NOT NULL) AND date_part('year', o.""OrderDate"")::INT = 1997) + @"SELECT min(o.""OrderID"") FILTER (WHERE o.""OrderID"" < 10300 AND (o.""OrderDate"" IS NOT NULL) AND date_part('year', o.""OrderDate"")::int = 1997) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1868,7 +1868,7 @@ public override async Task GroupBy_multiple_Count_with_predicate(bool async) await base.GroupBy_multiple_Count_with_predicate(async); AssertSql( - @"SELECT o.""CustomerID"", COUNT(*)::INT AS ""All"", COUNT(*) FILTER (WHERE o.""OrderID"" < 11000)::INT AS ""TenK"", COUNT(*) FILTER (WHERE o.""OrderID"" < 12000)::INT AS ""EleventK"" + @"SELECT o.""CustomerID"", count(*)::int AS ""All"", count(*) FILTER (WHERE o.""OrderID"" < 11000)::int AS ""TenK"", count(*) FILTER (WHERE o.""OrderID"" < 12000)::int AS ""EleventK"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1878,13 +1878,13 @@ public override async Task GroupBy_multiple_Sum_with_conditional_projection(bool await base.GroupBy_multiple_Sum_with_conditional_projection(async); AssertSql( - @"SELECT o.""CustomerID"", COALESCE(SUM(CASE + @"SELECT o.""CustomerID"", COALESCE(sum(CASE WHEN o.""OrderID"" < 11000 THEN o.""OrderID"" ELSE 0 -END), 0)::INT AS ""TenK"", COALESCE(SUM(CASE +END), 0)::int AS ""TenK"", COALESCE(sum(CASE WHEN o.""OrderID"" >= 11000 THEN o.""OrderID"" ELSE 0 -END), 0)::INT AS ""EleventK"" +END), 0)::int AS ""EleventK"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1894,13 +1894,13 @@ public override async Task GroupBy_multiple_Sum_with_Select_conditional_projecti await base.GroupBy_multiple_Sum_with_Select_conditional_projection(async); AssertSql( - @"SELECT o.""CustomerID"", COALESCE(SUM(CASE + @"SELECT o.""CustomerID"", COALESCE(sum(CASE WHEN o.""OrderID"" < 11000 THEN o.""OrderID"" ELSE 0 -END), 0)::INT AS ""TenK"", COALESCE(SUM(CASE +END), 0)::int AS ""TenK"", COALESCE(sum(CASE WHEN o.""OrderID"" >= 11000 THEN o.""OrderID"" ELSE 0 -END), 0)::INT AS ""EleventK"" +END), 0)::int AS ""EleventK"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -1910,7 +1910,7 @@ public override async Task GroupBy_Key_as_part_of_element_selector(bool async) await base.GroupBy_Key_as_part_of_element_selector(async); AssertSql( - @"SELECT o.""OrderID"" AS ""Key"", AVG(o.""OrderID""::double precision) AS ""Avg"", MAX(o.""OrderDate"") AS ""Max"" + @"SELECT o.""OrderID"" AS ""Key"", avg(o.""OrderID""::double precision) AS ""Avg"", max(o.""OrderDate"") AS ""Max"" FROM ""Orders"" AS o GROUP BY o.""OrderID"""); } @@ -1920,7 +1920,7 @@ public override async Task GroupBy_composite_Key_as_part_of_element_selector(boo await base.GroupBy_composite_Key_as_part_of_element_selector(async); AssertSql( - @"SELECT o.""OrderID"", o.""CustomerID"", AVG(o.""OrderID""::double precision) AS ""Avg"", MAX(o.""OrderDate"") AS ""Max"" + @"SELECT o.""OrderID"", o.""CustomerID"", avg(o.""OrderID""::double precision) AS ""Avg"", max(o.""OrderDate"") AS ""Max"" FROM ""Orders"" AS o GROUP BY o.""OrderID"", o.""CustomerID"""); } @@ -1931,7 +1931,7 @@ public override async Task GroupBy_with_aggregate_through_navigation_property(bo AssertSql( @"SELECT ( - SELECT MAX(c.""Region"") + SELECT max(c.""Region"") FROM ""Orders"" AS o0 LEFT JOIN ""Customers"" AS c ON o0.""CustomerID"" = c.""CustomerID"" WHERE o.""EmployeeID"" = o0.""EmployeeID"" OR ((o.""EmployeeID"" IS NULL) AND (o0.""EmployeeID"" IS NULL))) AS max @@ -1945,9 +1945,9 @@ public override async Task GroupBy_with_aggregate_containing_complex_where(bool AssertSql( @"SELECT o.""EmployeeID"" AS ""Key"", ( - SELECT MAX(o0.""OrderID"") + SELECT max(o0.""OrderID"") FROM ""Orders"" AS o0 - WHERE o0.""EmployeeID""::bigint = CAST((MAX(o.""OrderID"") * 6) AS bigint) OR ((o0.""EmployeeID"" IS NULL) AND (MAX(o.""OrderID"") IS NULL))) AS ""Max"" + WHERE o0.""EmployeeID""::bigint = CAST((max(o.""OrderID"") * 6) AS bigint) OR ((o0.""EmployeeID"" IS NULL) AND (max(o.""OrderID"") IS NULL))) AS ""Max"" FROM ""Orders"" AS o GROUP BY o.""EmployeeID"""); } @@ -2081,7 +2081,7 @@ public override async Task Count_after_GroupBy_aggregate(bool async) await base.Count_after_GroupBy_aggregate(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ( SELECT o.""CustomerID"" FROM ""Orders"" AS o @@ -2094,7 +2094,7 @@ public override async Task LongCount_after_GroupBy_aggregate(bool async) await base.LongCount_after_GroupBy_aggregate(async); AssertSql( - @"SELECT COUNT(*) + @"SELECT count(*) FROM ( SELECT o.""CustomerID"" FROM ""Orders"" AS o @@ -2107,7 +2107,7 @@ public override async Task GroupBy_Select_Distinct_aggregate(bool async) await base.GroupBy_Select_Distinct_aggregate(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", AVG(DISTINCT o.""OrderID""::double precision) AS ""Average"", COUNT(DISTINCT o.""EmployeeID"")::INT AS ""Count"", COUNT(DISTINCT o.""EmployeeID"") AS ""LongCount"", MAX(DISTINCT o.""OrderDate"") AS ""Max"", MIN(DISTINCT o.""OrderDate"") AS ""Min"", COALESCE(SUM(DISTINCT o.""OrderID""), 0)::INT AS ""Sum"" + @"SELECT o.""CustomerID"" AS ""Key"", avg(DISTINCT o.""OrderID""::double precision) AS ""Average"", count(DISTINCT o.""EmployeeID"")::int AS ""Count"", count(DISTINCT o.""EmployeeID"") AS ""LongCount"", max(DISTINCT o.""OrderDate"") AS ""Max"", min(DISTINCT o.""OrderDate"") AS ""Min"", COALESCE(sum(DISTINCT o.""OrderID""), 0)::int AS ""Sum"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -2117,7 +2117,7 @@ public override async Task GroupBy_group_Distinct_Select_Distinct_aggregate(bool await base.GroupBy_group_Distinct_Select_Distinct_aggregate(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", MAX(DISTINCT o.""OrderDate"") AS ""Max"" + @"SELECT o.""CustomerID"" AS ""Key"", max(DISTINCT o.""OrderDate"") AS ""Max"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -2127,7 +2127,7 @@ public override async Task GroupBy_group_Where_Select_Distinct_aggregate(bool as await base.GroupBy_group_Where_Select_Distinct_aggregate(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", MAX(DISTINCT o.""OrderDate"") FILTER (WHERE (o.""OrderDate"" IS NOT NULL)) AS ""Max"" + @"SELECT o.""CustomerID"" AS ""Key"", max(DISTINCT o.""OrderDate"") FILTER (WHERE (o.""OrderDate"" IS NOT NULL)) AS ""Max"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -2137,16 +2137,16 @@ public override async Task MinMax_after_GroupBy_aggregate(bool async) await base.MinMax_after_GroupBy_aggregate(async); AssertSql( - @"SELECT MIN(t.c) + @"SELECT min(t.c) FROM ( - SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS c + SELECT COALESCE(sum(o.""OrderID""), 0)::int AS c FROM ""Orders"" AS o GROUP BY o.""CustomerID"" ) AS t", // - @"SELECT MAX(t.c) + @"SELECT max(t.c) FROM ( - SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS c + SELECT COALESCE(sum(o.""OrderID""), 0)::int AS c FROM ""Orders"" AS o GROUP BY o.""CustomerID"" ) AS t"); @@ -2173,7 +2173,7 @@ public override async Task All_after_GroupBy_aggregate2(bool async) SELECT 1 FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COALESCE(SUM(o.""OrderID""), 0)::INT < 0)"); + HAVING COALESCE(sum(o.""OrderID""), 0)::int < 0)"); } public override async Task Any_after_GroupBy_aggregate(bool async) @@ -2192,7 +2192,7 @@ public override async Task Count_after_GroupBy_without_aggregate(bool async) await base.Count_after_GroupBy_without_aggregate(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ( SELECT o.""CustomerID"" FROM ""Orders"" AS o @@ -2205,12 +2205,12 @@ public override async Task Count_with_predicate_after_GroupBy_without_aggregate( await base.Count_with_predicate_after_GroupBy_without_aggregate(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ( SELECT o.""CustomerID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 1 + HAVING count(*)::int > 1 ) AS t"); } @@ -2219,7 +2219,7 @@ public override async Task LongCount_after_GroupBy_without_aggregate(bool async) await base.LongCount_after_GroupBy_without_aggregate(async); AssertSql( - @"SELECT COUNT(*) + @"SELECT count(*) FROM ( SELECT o.""CustomerID"" FROM ""Orders"" AS o @@ -2232,12 +2232,12 @@ public override async Task LongCount_with_predicate_after_GroupBy_without_aggreg await base.LongCount_with_predicate_after_GroupBy_without_aggregate(async); AssertSql( - @"SELECT COUNT(*) + @"SELECT count(*) FROM ( SELECT o.""CustomerID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 1 + HAVING count(*)::int > 1 ) AS t"); } @@ -2261,7 +2261,7 @@ public override async Task Any_with_predicate_after_GroupBy_without_aggregate(bo SELECT 1 FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT > 1)"); + HAVING count(*)::int > 1)"); } public override async Task All_with_predicate_after_GroupBy_without_aggregate(bool async) @@ -2273,7 +2273,7 @@ public override async Task All_with_predicate_after_GroupBy_without_aggregate(bo SELECT 1 FROM ""Orders"" AS o GROUP BY o.""CustomerID"" - HAVING COUNT(*)::INT <= 1)"); + HAVING count(*)::int <= 1)"); } public override async Task GroupBy_aggregate_followed_by_another_GroupBy_aggregate(bool async) @@ -2281,11 +2281,11 @@ public override async Task GroupBy_aggregate_followed_by_another_GroupBy_aggrega await base.GroupBy_aggregate_followed_by_another_GroupBy_aggregate(async); AssertSql( - @"SELECT t0.""Key0"" AS ""Key"", COALESCE(SUM(t0.""Count""), 0)::INT AS ""Count"" + @"SELECT t0.""Key0"" AS ""Key"", COALESCE(sum(t0.""Count""), 0)::int AS ""Count"" FROM ( SELECT t.""Count"", 1 AS ""Key0"" FROM ( - SELECT COUNT(*)::INT AS ""Count"" + SELECT count(*)::int AS ""Count"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" ) AS t @@ -2302,7 +2302,7 @@ public override async Task GroupBy_Count_in_projection(bool async) SELECT 1 FROM ""Order Details"" AS o0 WHERE o.""OrderID"" = o0.""OrderID"" AND o0.""ProductID"" < 25) AS ""HasOrderDetails"", ( - SELECT COUNT(*)::INT + SELECT count(*)::int FROM ( SELECT p.""ProductName"" FROM ""Order Details"" AS o1 @@ -2319,7 +2319,7 @@ public override async Task GroupBy_nominal_type_count(bool async) await base.GroupBy_nominal_type_count(async); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ( SELECT o.""CustomerID"" FROM ""Orders"" AS o @@ -2332,7 +2332,7 @@ public override async Task GroupBy_based_on_renamed_property_simple(bool async) await base.GroupBy_based_on_renamed_property_simple(async); AssertSql( - @"SELECT c.""City"" AS ""Renamed"", COUNT(*)::INT AS ""Count"" + @"SELECT c.""City"" AS ""Renamed"", count(*)::int AS ""Count"" FROM ""Customers"" AS c GROUP BY c.""City"""); } @@ -2342,7 +2342,7 @@ public override async Task GroupBy_based_on_renamed_property_complex(bool async) await base.GroupBy_based_on_renamed_property_complex(async); AssertSql( - @"SELECT t.""Renamed"" AS ""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT t.""Renamed"" AS ""Key"", count(*)::int AS ""Count"" FROM ( SELECT DISTINCT c.""City"" AS ""Renamed"", c.""CustomerID"" FROM ""Customers"" AS c @@ -2367,7 +2367,7 @@ public override async Task Odata_groupby_empty_key(bool async) await base.Odata_groupby_empty_key(async); AssertSql( - @"SELECT 'TotalAmount' AS ""Name"", COALESCE(SUM(t.""OrderID""::numeric), 0.0) AS ""Value"" + @"SELECT 'TotalAmount' AS ""Name"", COALESCE(sum(t.""OrderID""::numeric), 0.0) AS ""Value"" FROM ( SELECT o.""OrderID"", 1 AS ""Key"" FROM ""Orders"" AS o @@ -2380,7 +2380,7 @@ public override async Task GroupBy_with_group_key_access_thru_navigation(bool as await base.GroupBy_with_group_key_access_thru_navigation(async); AssertSql( - @"SELECT o0.""CustomerID"" AS ""Key"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Aggregate"" + @"SELECT o0.""CustomerID"" AS ""Key"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Aggregate"" FROM ""Order Details"" AS o INNER JOIN ""Orders"" AS o0 ON o.""OrderID"" = o0.""OrderID"" GROUP BY o0.""CustomerID"""); @@ -2391,7 +2391,7 @@ public override async Task GroupBy_with_group_key_access_thru_nested_navigation( await base.GroupBy_with_group_key_access_thru_nested_navigation(async); AssertSql( - @"SELECT c.""Country"" AS ""Key"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Aggregate"" + @"SELECT c.""Country"" AS ""Key"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Aggregate"" FROM ""Order Details"" AS o INNER JOIN ""Orders"" AS o0 ON o.""OrderID"" = o0.""OrderID"" LEFT JOIN ""Customers"" AS c ON o0.""CustomerID"" = c.""CustomerID"" @@ -2435,7 +2435,7 @@ public override async Task GroupBy_with_order_by_skip_and_another_order_by(bool AssertSql( @"@__p_0='80' -SELECT COALESCE(SUM(t.""OrderID""), 0)::INT +SELECT COALESCE(sum(t.""OrderID""), 0)::int FROM ( SELECT o.""OrderID"", o.""CustomerID"" FROM ""Orders"" AS o @@ -2450,7 +2450,7 @@ public override async Task GroupBy_Property_Select_Count_with_predicate(bool asy await base.GroupBy_Property_Select_Count_with_predicate(async); AssertSql( - @"SELECT COUNT(*) FILTER (WHERE o.""OrderID"" < 10300)::INT + @"SELECT count(*) FILTER (WHERE o.""OrderID"" < 10300)::int FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -2460,7 +2460,7 @@ public override async Task GroupBy_Property_Select_LongCount_with_predicate(bool await base.GroupBy_Property_Select_LongCount_with_predicate(async); AssertSql( - @"SELECT COUNT(*) FILTER (WHERE o.""OrderID"" < 10300) + @"SELECT count(*) FILTER (WHERE o.""OrderID"" < 10300) FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -2470,10 +2470,10 @@ public override async Task GroupBy_orderby_projection_with_coalesce_operation(bo await base.GroupBy_orderby_projection_with_coalesce_operation(async); AssertSql( - @"SELECT COALESCE(c.""City"", 'Unknown') AS ""Locality"", COUNT(*)::INT AS ""Count"" + @"SELECT COALESCE(c.""City"", 'Unknown') AS ""Locality"", count(*)::int AS ""Count"" FROM ""Customers"" AS c GROUP BY c.""City"" -ORDER BY COUNT(*)::INT DESC NULLS LAST, c.""City"" NULLS FIRST"); +ORDER BY count(*)::int DESC NULLS LAST, c.""City"" NULLS FIRST"); } public override async Task GroupBy_let_orderby_projection_with_coalesce_operation(bool async) @@ -2488,11 +2488,11 @@ public override async Task GroupBy_Min_Where_optional_relationship(bool async) await base.GroupBy_Min_Where_optional_relationship(async); AssertSql( - @"SELECT c.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT c.""CustomerID"" AS ""Key"", count(*)::int AS ""Count"" FROM ""Orders"" AS o LEFT JOIN ""Customers"" AS c ON o.""CustomerID"" = c.""CustomerID"" GROUP BY c.""CustomerID"" -HAVING COUNT(*)::INT <> 2"); +HAVING count(*)::int <> 2"); } public override async Task GroupBy_Min_Where_optional_relationship_2(bool async) @@ -2500,11 +2500,11 @@ public override async Task GroupBy_Min_Where_optional_relationship_2(bool async) await base.GroupBy_Min_Where_optional_relationship_2(async); AssertSql( - @"SELECT c.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT c.""CustomerID"" AS ""Key"", count(*)::int AS ""Count"" FROM ""Orders"" AS o LEFT JOIN ""Customers"" AS c ON o.""CustomerID"" = c.""CustomerID"" GROUP BY c.""CustomerID"" -HAVING COUNT(*)::INT < 2 OR COUNT(*)::INT > 2"); +HAVING count(*)::int < 2 OR count(*)::int > 2"); } public override async Task GroupBy_aggregate_over_a_subquery(bool async) @@ -2513,7 +2513,7 @@ public override async Task GroupBy_aggregate_over_a_subquery(bool async) AssertSql( @"SELECT o.""CustomerID"" AS ""Key"", ( - SELECT COUNT(*)::INT + SELECT count(*)::int FROM ""Customers"" AS c WHERE c.""CustomerID"" = o.""CustomerID"") AS ""Count"" FROM ""Orders"" AS o @@ -2527,7 +2527,7 @@ public override async Task GroupBy_aggregate_join_with_grouping_key(bool async) AssertSql( @"SELECT c.""CustomerID"", c.""Address"", c.""City"", c.""CompanyName"", c.""ContactName"", c.""ContactTitle"", c.""Country"", c.""Fax"", c.""Phone"", c.""PostalCode"", c.""Region"", t.""Count"" FROM ( - SELECT o.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Count"" + SELECT o.""CustomerID"" AS ""Key"", count(*)::int AS ""Count"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" ) AS t @@ -2541,7 +2541,7 @@ public override async Task GroupBy_aggregate_join_with_group_result(bool async) AssertSql( @"SELECT o0.""OrderID"", o0.""CustomerID"", o0.""EmployeeID"", o0.""OrderDate"" FROM ( - SELECT o.""CustomerID"" AS ""Key"", MAX(o.""OrderDate"") AS ""LastOrderDate"" + SELECT o.""CustomerID"" AS ""Key"", max(o.""OrderDate"") AS ""LastOrderDate"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" ) AS t @@ -2558,7 +2558,7 @@ public override async Task GroupBy_aggregate_from_right_side_of_join(bool async) SELECT c.""CustomerID"", c.""Address"", c.""City"", c.""CompanyName"", c.""ContactName"", c.""ContactTitle"", c.""Country"", c.""Fax"", c.""Phone"", c.""PostalCode"", c.""Region"", t.""Max"" FROM ""Customers"" AS c INNER JOIN ( - SELECT o.""CustomerID"" AS ""Key"", MAX(o.""OrderDate"") AS ""Max"" + SELECT o.""CustomerID"" AS ""Key"", max(o.""OrderDate"") AS ""Max"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" ) AS t ON c.""CustomerID"" = t.""Key"" @@ -2573,14 +2573,14 @@ public override async Task GroupBy_aggregate_join_another_GroupBy_aggregate(bool AssertSql( @"SELECT t.""Key"", t.""Total"", t0.""ThatYear"" FROM ( - SELECT o.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Total"" + SELECT o.""CustomerID"" AS ""Key"", count(*)::int AS ""Total"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" ) AS t INNER JOIN ( - SELECT o0.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""ThatYear"" + SELECT o0.""CustomerID"" AS ""Key"", count(*)::int AS ""ThatYear"" FROM ""Orders"" AS o0 - WHERE date_part('year', o0.""OrderDate"")::INT = 1997 + WHERE date_part('year', o0.""OrderDate"")::int = 1997 GROUP BY o0.""CustomerID"" ) AS t0 ON t.""Key"" = t0.""Key"""); } @@ -2592,7 +2592,7 @@ public override async Task GroupBy_aggregate_after_skip_0_take_0(bool async) AssertSql( @"@__p_0='0' -SELECT t.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Total"" +SELECT t.""CustomerID"" AS ""Key"", count(*)::int AS ""Total"" FROM ( SELECT o.""CustomerID"" FROM ""Orders"" AS o @@ -2608,7 +2608,7 @@ public override async Task GroupBy_skip_0_take_0_aggregate(bool async) AssertSql( @"@__p_0='0' -SELECT o.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Total"" +SELECT o.""CustomerID"" AS ""Key"", count(*)::int AS ""Total"" FROM ""Orders"" AS o WHERE o.""OrderID"" > 10500 GROUP BY o.""CustomerID"" @@ -2620,11 +2620,11 @@ public override async Task GroupBy_aggregate_followed_another_GroupBy_aggregate( await base.GroupBy_aggregate_followed_another_GroupBy_aggregate(async); AssertSql( - @"SELECT t0.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT t0.""CustomerID"" AS ""Key"", count(*)::int AS ""Count"" FROM ( SELECT t.""CustomerID"" FROM ( - SELECT o.""CustomerID"", date_part('year', o.""OrderDate"")::INT AS ""Year"" + SELECT o.""CustomerID"", date_part('year', o.""OrderDate"")::int AS ""Year"" FROM ""Orders"" AS o ) AS t GROUP BY t.""CustomerID"", t.""Year"" @@ -2639,7 +2639,7 @@ public override async Task GroupBy_aggregate_without_selectMany_selecting_first( AssertSql( @"SELECT o0.""OrderID"", o0.""CustomerID"", o0.""EmployeeID"", o0.""OrderDate"" FROM ( - SELECT MIN(o.""OrderID"") AS c + SELECT min(o.""OrderID"") AS c FROM ""Orders"" AS o GROUP BY o.""CustomerID"" ) AS t @@ -2682,7 +2682,7 @@ public override async Task GroupBy_with_grouping_key_using_Like(bool async) await base.GroupBy_with_grouping_key_using_Like(async); AssertSql( - @"SELECT t.""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT t.""Key"", count(*)::int AS ""Count"" FROM ( SELECT o.""CustomerID"" LIKE 'A%' AS ""Key"" FROM ""Orders"" AS o @@ -2695,9 +2695,9 @@ public override async Task GroupBy_with_grouping_key_DateTime_Day(bool async) await base.GroupBy_with_grouping_key_DateTime_Day(async); AssertSql( - @"SELECT t.""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT t.""Key"", count(*)::int AS ""Count"" FROM ( - SELECT date_part('day', o.""OrderDate"")::INT AS ""Key"" + SELECT date_part('day', o.""OrderDate"")::int AS ""Key"" FROM ""Orders"" AS o ) AS t GROUP BY t.""Key"""); @@ -2708,7 +2708,7 @@ public override async Task GroupBy_with_cast_inside_grouping_aggregate(bool asyn await base.GroupBy_with_cast_inside_grouping_aggregate(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COUNT(*)::INT AS ""Count"", COALESCE(SUM(o.""OrderID""::bigint), 0.0)::bigint AS ""Sum"" + @"SELECT o.""CustomerID"" AS ""Key"", count(*)::int AS ""Count"", COALESCE(sum(o.""OrderID""::bigint), 0.0)::bigint AS ""Sum"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -2721,7 +2721,7 @@ public override async Task Complex_query_with_groupBy_in_subquery1(bool async) @"SELECT c.""CustomerID"", t.""Sum"", t.""CustomerID"" FROM ""Customers"" AS c LEFT JOIN LATERAL ( - SELECT COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", o.""CustomerID"" + SELECT COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", o.""CustomerID"" FROM ""Orders"" AS o WHERE c.""CustomerID"" = o.""CustomerID"" GROUP BY o.""CustomerID"" @@ -2737,7 +2737,7 @@ public override async Task Complex_query_with_groupBy_in_subquery2(bool async) @"SELECT c.""CustomerID"", t.""Max"", t.""Sum"", t.""CustomerID"" FROM ""Customers"" AS c LEFT JOIN LATERAL ( - SELECT MAX(length(o.""CustomerID"")::INT) AS ""Max"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", o.""CustomerID"" + SELECT max(length(o.""CustomerID"")::int) AS ""Max"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", o.""CustomerID"" FROM ""Orders"" AS o WHERE c.""CustomerID"" = o.""CustomerID"" GROUP BY o.""CustomerID"" @@ -2753,7 +2753,7 @@ public override async Task Complex_query_with_groupBy_in_subquery3(bool async) @"SELECT c.""CustomerID"", t.""Max"", t.""Sum"", t.""CustomerID"" FROM ""Customers"" AS c LEFT JOIN LATERAL ( - SELECT MAX(length(o.""CustomerID"")::INT) AS ""Max"", COALESCE(SUM(o.""OrderID""), 0)::INT AS ""Sum"", o.""CustomerID"" + SELECT max(length(o.""CustomerID"")::int) AS ""Max"", COALESCE(sum(o.""OrderID""), 0)::int AS ""Sum"", o.""CustomerID"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"" ) AS t ON TRUE @@ -2765,7 +2765,7 @@ public override async Task Group_by_with_projection_into_DTO(bool async) await base.Group_by_with_projection_into_DTO(async); AssertSql( - @"SELECT o.""OrderID""::bigint AS ""Id"", COUNT(*)::INT AS ""Count"" + @"SELECT o.""OrderID""::bigint AS ""Id"", count(*)::int AS ""Count"" FROM ""Orders"" AS o GROUP BY o.""OrderID"""); } @@ -2775,13 +2775,13 @@ public override async Task Where_select_function_groupby_followed_by_another_sel await base.Where_select_function_groupby_followed_by_another_select_with_aggregates(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(SUM(CASE - WHEN (2020 - date_part('year', o.""OrderDate"")::INT) <= 30 THEN o.""OrderID"" + @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(sum(CASE + WHEN (2020 - date_part('year', o.""OrderDate"")::int) <= 30 THEN o.""OrderID"" ELSE 0 -END), 0)::INT AS ""Sum1"", COALESCE(SUM(CASE - WHEN (2020 - date_part('year', o.""OrderDate"")::INT) > 30 AND (2020 - date_part('year', o.""OrderDate"")::INT) <= 60 THEN o.""OrderID"" +END), 0)::int AS ""Sum1"", COALESCE(sum(CASE + WHEN (2020 - date_part('year', o.""OrderDate"")::int) > 30 AND (2020 - date_part('year', o.""OrderDate"")::int) <= 60 THEN o.""OrderID"" ELSE 0 -END), 0)::INT AS ""Sum2"" +END), 0)::int AS ""Sum2"" FROM ""Orders"" AS o WHERE (o.""CustomerID"" IS NOT NULL) AND (o.""CustomerID"" LIKE 'A%') GROUP BY o.""CustomerID"""); @@ -2803,7 +2803,7 @@ public override async Task Key_plus_key_in_projection(bool async) await base.Key_plus_key_in_projection(async); AssertSql( - @"SELECT o.""OrderID"" + o.""OrderID"" AS ""Value"", AVG(o.""OrderID""::double precision) AS ""Average"" + @"SELECT o.""OrderID"" + o.""OrderID"" AS ""Value"", avg(o.""OrderID""::double precision) AS ""Average"" FROM ""Orders"" AS o LEFT JOIN ""Customers"" AS c ON o.""CustomerID"" = c.""CustomerID"" GROUP BY o.""OrderID"""); @@ -2814,7 +2814,7 @@ public override async Task Group_by_with_arithmetic_operation_inside_aggregate(b await base.Group_by_with_arithmetic_operation_inside_aggregate(async); AssertSql( - @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(SUM(o.""OrderID"" + length(o.""CustomerID"")::INT), 0)::INT AS ""Sum"" + @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(sum(o.""OrderID"" + length(o.""CustomerID"")::int), 0)::int AS ""Sum"" FROM ""Orders"" AS o GROUP BY o.""CustomerID"""); } @@ -2824,7 +2824,7 @@ public override async Task GroupBy_scalar_subquery(bool async) await base.GroupBy_scalar_subquery(async); AssertSql( - @"SELECT t.""Key"", COUNT(*)::INT AS ""Count"" + @"SELECT t.""Key"", count(*)::int AS ""Count"" FROM ( SELECT ( SELECT c.""ContactName"" @@ -2894,7 +2894,7 @@ public override async Task GroupBy_aggregate_from_multiple_query_in_same_project AssertSql( @"SELECT o.""CustomerID"" AS ""Key"", COALESCE(( - SELECT COUNT(*)::INT + MIN(o.""OrderID"") + SELECT count(*)::int + min(o.""OrderID"") FROM ""Employees"" AS e WHERE e.""City"" = 'Seattle' GROUP BY e.""City"" @@ -2957,7 +2957,7 @@ SELECT p.""ProductID"" GROUP BY p.""ProductID"" ) AS t0 ON TRUE LEFT JOIN LATERAL ( - SELECT COUNT(*)::INT AS c, p0.""ProductID"" + SELECT count(*)::int AS c, p0.""ProductID"" FROM ""Products"" AS p0 GROUP BY p0.""ProductID"" ) AS t1 ON TRUE @@ -3007,7 +3007,7 @@ public override async Task Complex_query_with_group_by_in_subquery5(bool async) AssertSql( @"SELECT t.c, t.""ProductID"", t0.""CustomerID"", t0.""City"" FROM ( - SELECT COALESCE(SUM(o.""ProductID"" + (o.""OrderID"" * 1000)), 0)::INT AS c, o.""ProductID"", MIN(o.""OrderID"" / 100) AS c0 + SELECT COALESCE(sum(o.""ProductID"" + (o.""OrderID"" * 1000)), 0)::int AS c, o.""ProductID"", min(o.""OrderID"" / 100) AS c0 FROM ""Order Details"" AS o INNER JOIN ""Orders"" AS o0 ON o.""OrderID"" = o0.""OrderID"" LEFT JOIN ""Customers"" AS c ON o0.""CustomerID"" = c.""CustomerID"" @@ -3017,7 +3017,7 @@ GROUP BY o.""ProductID"" LEFT JOIN LATERAL ( SELECT c0.""CustomerID"", c0.""City"" FROM ""Customers"" AS c0 - WHERE length(c0.""CustomerID"")::INT < t.c0 + WHERE length(c0.""CustomerID"")::int < t.c0 ) AS t0 ON TRUE ORDER BY t.""ProductID"" NULLS FIRST, t0.""CustomerID"" NULLS FIRST"); } @@ -3030,8 +3030,8 @@ public override async Task Complex_query_with_groupBy_in_subquery4(bool async) @"SELECT c.""CustomerID"", t1.""Sum"", t1.""Count"", t1.""Key"" FROM ""Customers"" AS c LEFT JOIN LATERAL ( - SELECT COALESCE(SUM(t.""OrderID""), 0)::INT AS ""Sum"", ( - SELECT COUNT(*)::INT + SELECT COALESCE(sum(t.""OrderID""), 0)::int AS ""Sum"", ( + SELECT count(*)::int FROM ( SELECT o0.""OrderID"", o0.""CustomerID"", o0.""EmployeeID"", o0.""OrderDate"", c1.""CustomerID"" AS ""CustomerID0"", c1.""Address"", c1.""City"", c1.""CompanyName"", c1.""ContactName"", c1.""ContactTitle"", c1.""Country"", c1.""Fax"", c1.""Phone"", c1.""PostalCode"", c1.""Region"", COALESCE(c1.""City"", '') || COALESCE(o0.""CustomerID"", '') AS ""Key"" FROM ""Orders"" AS o0 diff --git a/test/EFCore.PG.FunctionalTests/Query/NorthwindMiscellaneousQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/NorthwindMiscellaneousQueryNpgsqlTest.cs index cb9f4af53..7214ea16f 100644 --- a/test/EFCore.PG.FunctionalTests/Query/NorthwindMiscellaneousQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/NorthwindMiscellaneousQueryNpgsqlTest.cs @@ -80,7 +80,7 @@ await AssertFirst( .Select(o => new { Elapsed = (DateTime.Today - ((DateTime)o.OrderDate).Date).Days })); AssertSql( - @"SELECT floor(date_part('day', date_trunc('day', now()::timestamp) - date_trunc('day', o.""OrderDate"")))::INT AS ""Elapsed"" + @"SELECT floor(date_part('day', date_trunc('day', now()::timestamp) - date_trunc('day', o.""OrderDate"")))::int AS ""Elapsed"" FROM ""Orders"" AS o WHERE (o.""OrderDate"" IS NOT NULL) LIMIT 1"); @@ -146,8 +146,8 @@ public override async Task Max_on_empty_sequence_throws(bool async) await Assert.ThrowsAsync(() => base.Max_on_empty_sequence_throws(async)); AssertSql( - @"SELECT ( - SELECT MAX(o.""OrderID"") + @"SELECT ( + SELECT max(o.""OrderID"") FROM ""Orders"" AS o WHERE c.""CustomerID"" = o.""CustomerID"") AS ""Max"" FROM ""Customers"" AS c"); diff --git a/test/EFCore.PG.FunctionalTests/Query/NorthwindSelectQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/NorthwindSelectQueryNpgsqlTest.cs index ceb35eeec..940aaa820 100644 --- a/test/EFCore.PG.FunctionalTests/Query/NorthwindSelectQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/NorthwindSelectQueryNpgsqlTest.cs @@ -15,7 +15,7 @@ public override async Task Select_datetime_DayOfWeek_component(bool async) await base.Select_datetime_DayOfWeek_component(async); AssertSql( - @"SELECT floor(date_part('dow', o.""OrderDate""))::INT + @"SELECT floor(date_part('dow', o.""OrderDate""))::int FROM ""Orders"" AS o"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/NorthwindSetOperationsQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/NorthwindSetOperationsQueryNpgsqlTest.cs index b8d9138c7..2a0468a92 100644 --- a/test/EFCore.PG.FunctionalTests/Query/NorthwindSetOperationsQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/NorthwindSetOperationsQueryNpgsqlTest.cs @@ -42,7 +42,7 @@ await AssertQuery( .Union(ss.Set().Select(o => new { OrderID = (int?)o.OrderID, o.CustomerID }))); AssertSql( - @"SELECT NULL::INT AS ""OrderID"", o.""CustomerID"" + @"SELECT NULL::int AS ""OrderID"", o.""CustomerID"" FROM ""Orders"" AS o UNION SELECT NULL AS ""OrderID"", o0.""CustomerID"" @@ -64,7 +64,7 @@ await AssertQuery( .Union(ss.Set().Select(o => new { OrderID = (int?)o.OrderID, o.CustomerID }))); AssertSql( - @"SELECT NULL::INT AS ""OrderID"", o.""CustomerID"" + @"SELECT NULL::int AS ""OrderID"", o.""CustomerID"" FROM ""Orders"" AS o UNION SELECT NULL AS ""OrderID"", o0.""CustomerID"" @@ -90,7 +90,7 @@ await AssertQuery( .Union(ss.Set().Select(o => new { OrderID = (int?)o.OrderID, o.CustomerID }))); AssertSql( - @"SELECT NULL::INT AS ""OrderID"", o.""CustomerID"" + @"SELECT NULL::int AS ""OrderID"", o.""CustomerID"" FROM ""Orders"" AS o UNION SELECT NULL AS ""OrderID"", o0.""CustomerID"" @@ -126,7 +126,7 @@ await AssertQuery( AssertSql( @"SELECT t0.""OrderID"", t0.""CustomerID"" FROM ( - SELECT NULL::INT AS ""OrderID"", o.""CustomerID"" + SELECT NULL::int AS ""OrderID"", o.""CustomerID"" FROM ""Orders"" AS o UNION SELECT NULL AS ""OrderID"", o0.""CustomerID"" @@ -138,7 +138,7 @@ await AssertQuery( WHERE t0.""CustomerID"" = ( SELECT t1.""CustomerID"" FROM ( - SELECT NULL::INT AS ""OrderID"", o2.""CustomerID"" + SELECT NULL::int AS ""OrderID"", o2.""CustomerID"" FROM ""Orders"" AS o2 UNION SELECT NULL AS ""OrderID"", o3.""CustomerID"" @@ -151,7 +151,7 @@ ORDER BY t1.""CustomerID"" NULLS FIRST LIMIT 1) OR ((t0.""CustomerID"" IS NULL) AND (( SELECT t1.""CustomerID"" FROM ( - SELECT NULL::INT AS ""OrderID"", o2.""CustomerID"" + SELECT NULL::int AS ""OrderID"", o2.""CustomerID"" FROM ""Orders"" AS o2 UNION SELECT NULL AS ""OrderID"", o3.""CustomerID"" diff --git a/test/EFCore.PG.FunctionalTests/Query/NorthwindWhereQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/NorthwindWhereQueryNpgsqlTest.cs index ccb07954c..ddbf9a22d 100644 --- a/test/EFCore.PG.FunctionalTests/Query/NorthwindWhereQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/NorthwindWhereQueryNpgsqlTest.cs @@ -50,7 +50,7 @@ public override async Task Where_date_add_year_constant_component(bool async) AssertSql( @"SELECT o.""OrderID"", o.""CustomerID"", o.""EmployeeID"", o.""OrderDate"" FROM ""Orders"" AS o -WHERE date_part('year', o.""OrderDate"" + INTERVAL '-1 years')::INT = 1997"); +WHERE date_part('year', o.""OrderDate"" + INTERVAL '-1 years')::int = 1997"); } public override async Task Where_datetime_year_component(bool async) @@ -60,7 +60,7 @@ public override async Task Where_datetime_year_component(bool async) AssertSql( @"SELECT o.""OrderID"", o.""CustomerID"", o.""EmployeeID"", o.""OrderDate"" FROM ""Orders"" AS o -WHERE date_part('year', o.""OrderDate"")::INT = 1998"); +WHERE date_part('year', o.""OrderDate"")::int = 1998"); } public override async Task Where_datetime_month_component(bool async) @@ -70,7 +70,7 @@ public override async Task Where_datetime_month_component(bool async) AssertSql( @"SELECT o.""OrderID"", o.""CustomerID"", o.""EmployeeID"", o.""OrderDate"" FROM ""Orders"" AS o -WHERE date_part('month', o.""OrderDate"")::INT = 4"); +WHERE date_part('month', o.""OrderDate"")::int = 4"); } public override async Task Where_datetime_dayOfYear_component(bool async) @@ -80,7 +80,7 @@ public override async Task Where_datetime_dayOfYear_component(bool async) AssertSql( @"SELECT o.""OrderID"", o.""CustomerID"", o.""EmployeeID"", o.""OrderDate"" FROM ""Orders"" AS o -WHERE date_part('doy', o.""OrderDate"")::INT = 68"); +WHERE date_part('doy', o.""OrderDate"")::int = 68"); } public override async Task Where_datetime_day_component(bool async) @@ -90,7 +90,7 @@ public override async Task Where_datetime_day_component(bool async) AssertSql( @"SELECT o.""OrderID"", o.""CustomerID"", o.""EmployeeID"", o.""OrderDate"" FROM ""Orders"" AS o -WHERE date_part('day', o.""OrderDate"")::INT = 4"); +WHERE date_part('day', o.""OrderDate"")::int = 4"); } public override async Task Where_datetime_hour_component(bool async) @@ -100,7 +100,7 @@ public override async Task Where_datetime_hour_component(bool async) AssertSql( @"SELECT o.""OrderID"", o.""CustomerID"", o.""EmployeeID"", o.""OrderDate"" FROM ""Orders"" AS o -WHERE date_part('hour', o.""OrderDate"")::INT = 14"); +WHERE date_part('hour', o.""OrderDate"")::int = 14"); } public override async Task Where_datetime_minute_component(bool async) @@ -110,7 +110,7 @@ public override async Task Where_datetime_minute_component(bool async) AssertSql( @"SELECT o.""OrderID"", o.""CustomerID"", o.""EmployeeID"", o.""OrderDate"" FROM ""Orders"" AS o -WHERE date_part('minute', o.""OrderDate"")::INT = 23"); +WHERE date_part('minute', o.""OrderDate"")::int = 23"); } public override async Task Where_datetime_second_component(bool async) @@ -120,7 +120,7 @@ public override async Task Where_datetime_second_component(bool async) AssertSql( @"SELECT o.""OrderID"", o.""CustomerID"", o.""EmployeeID"", o.""OrderDate"" FROM ""Orders"" AS o -WHERE date_part('second', o.""OrderDate"")::INT = 44"); +WHERE date_part('second', o.""OrderDate"")::int = 44"); } public override Task Where_datetime_millisecond_component(bool async) @@ -250,7 +250,7 @@ public async Task Row_value_GreaterThan() .CountAsync(); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE (c.""City"", c.""CustomerID"") > ('Buenos Aires', 'OCEAN')"); } @@ -267,7 +267,7 @@ public async Task Row_value_GreaterThan_with_differing_types() .CountAsync(); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Orders"" AS o WHERE (o.""CustomerID"", o.""OrderID"") > ('ALFKI', 10702)"); } @@ -288,7 +288,7 @@ public async Task Row_value_GreaterThan_with_parameter() AssertSql( @"@__city1_1='Buenos Aires' -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""Customers"" AS c WHERE (c.""City"", c.""CustomerID"") > (@__city1_1, 'OCEAN')"); } @@ -309,7 +309,7 @@ public async Task Row_value_GreaterThan_with_parameter_with_ValueTuple_construct AssertSql( @"@__city1_1='Buenos Aires' -SELECT COUNT(*)::INT +SELECT count(*)::int FROM ""Customers"" AS c WHERE (c.""City"", c.""CustomerID"") > (@__city1_1, 'OCEAN')"); } @@ -326,7 +326,7 @@ public async Task Row_value_LessThan() .CountAsync(); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE (c.""City"", c.""CustomerID"") < ('Buenos Aires', 'OCEAN')"); } @@ -343,7 +343,7 @@ public async Task Row_value_GreaterThanOrEqual() .CountAsync(); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE (c.""City"", c.""CustomerID"") >= ('Buenos Aires', 'OCEAN')"); } @@ -360,7 +360,7 @@ public async Task Row_value_LessThanOrEqual() .CountAsync(); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE (c.""City"", c.""CustomerID"") <= ('Buenos Aires', 'OCEAN')"); } @@ -377,7 +377,7 @@ public async Task Row_value_with_ValueTuple_constructor() .CountAsync(); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE (c.""City"", c.""CustomerID"") > ('Buenos Aires', 'OCEAN')"); } @@ -409,7 +409,7 @@ public async Task Row_value_equals() .CountAsync(); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE (c.""City"", c.""CustomerID"") = ('Buenos Aires', 'OCEAN')"); } @@ -424,7 +424,7 @@ public async Task Row_value_not_equals() .CountAsync(); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE (c.""City"", c.""CustomerID"") <> ('Buenos Aires', 'OCEAN')"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/RangeQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/RangeQueryNpgsqlTest.cs index d57cd618a..9fa8ad42d 100644 --- a/test/EFCore.PG.FunctionalTests/Query/RangeQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/RangeQueryNpgsqlTest.cs @@ -311,7 +311,7 @@ public void LowerBoundIsInclusive() Assert.Equal(0, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""RangeTestEntities"" AS r WHERE NOT (lower_inc(r.""IntRange""))"); } @@ -324,7 +324,7 @@ public void UpperBoundIsInclusive() Assert.Equal(0, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""RangeTestEntities"" AS r WHERE upper_inc(r.""IntRange"")"); } @@ -337,7 +337,7 @@ public void LowerBoundInfinite() Assert.Equal(0, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""RangeTestEntities"" AS r WHERE lower_inf(r.""IntRange"")"); } @@ -350,7 +350,7 @@ public void UpperBoundInfinite() Assert.Equal(0, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""RangeTestEntities"" AS r WHERE upper_inf(r.""IntRange"")"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/TimestampQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/TimestampQueryTest.cs index 79a0f70dc..69c075c7b 100644 --- a/test/EFCore.PG.FunctionalTests/Query/TimestampQueryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/TimestampQueryTest.cs @@ -268,7 +268,7 @@ public async Task Compare_timestamptz_column_to_timestamp_column_with_ToUniversa Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Entities"" AS e WHERE e.""TimestamptzDateTime"" = e.""TimestampDateTime""::timestamptz"); } @@ -287,7 +287,7 @@ public async Task Compare_timestamptz_column_to_timestamp_column_with_ToLocalTim Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Entities"" AS e WHERE e.""TimestamptzDateTime""::timestamp = e.""TimestampDateTime"""); } @@ -424,7 +424,7 @@ public async Task DateTimeOffset_LocalDateTime() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Entities"" AS e WHERE e.""TimestampDateTimeOffset""::timestamp = TIMESTAMP '1998-04-12 15:26:38'"); } @@ -467,7 +467,7 @@ await AssertQuery( AssertSql( @"SELECT e.""Id"", e.""TimestampDateTime"", e.""TimestampDateTimeArray"", e.""TimestampDateTimeOffset"", e.""TimestampDateTimeOffsetArray"", e.""TimestampDateTimeRange"", e.""TimestamptzDateTime"", e.""TimestamptzDateTimeArray"", e.""TimestamptzDateTimeRange"" FROM ""Entities"" AS e -WHERE make_date(date_part('year', e.""TimestampDateTime"")::INT, date_part('month', e.""TimestampDateTime"")::INT, 1) = TIMESTAMP '1998-04-12 00:00:00'"); +WHERE make_date(date_part('year', e.""TimestampDateTime"")::int, date_part('month', e.""TimestampDateTime"")::int, 1) = TIMESTAMP '1998-04-12 00:00:00'"); } [ConditionalTheory] @@ -482,7 +482,7 @@ await AssertQuery( AssertSql( @"SELECT e.""Id"", e.""TimestampDateTime"", e.""TimestampDateTimeArray"", e.""TimestampDateTimeOffset"", e.""TimestampDateTimeOffsetArray"", e.""TimestampDateTimeRange"", e.""TimestamptzDateTime"", e.""TimestamptzDateTimeArray"", e.""TimestamptzDateTimeRange"" FROM ""Entities"" AS e -WHERE make_timestamp(date_part('year', e.""TimestampDateTime"")::INT, date_part('month', e.""TimestampDateTime"")::INT, 1, 0, 0, 0::double precision) = TIMESTAMP '1998-04-12 00:00:00'"); +WHERE make_timestamp(date_part('year', e.""TimestampDateTime"")::int, date_part('month', e.""TimestampDateTime"")::int, 1, 0, 0, 0::double precision) = TIMESTAMP '1998-04-12 00:00:00'"); } [ConditionalTheory] @@ -497,7 +497,7 @@ await AssertQuery( AssertSql( @"SELECT e.""Id"", e.""TimestampDateTime"", e.""TimestampDateTimeArray"", e.""TimestampDateTimeOffset"", e.""TimestampDateTimeOffsetArray"", e.""TimestampDateTimeRange"", e.""TimestamptzDateTime"", e.""TimestamptzDateTimeArray"", e.""TimestamptzDateTimeRange"" FROM ""Entities"" AS e -WHERE make_timestamp(date_part('year', e.""TimestampDateTime"")::INT, date_part('month', e.""TimestampDateTime"")::INT, 1, 0, 0, 0::double precision) = TIMESTAMP '1996-09-11 00:00:00'"); +WHERE make_timestamp(date_part('year', e.""TimestampDateTime"")::int, date_part('month', e.""TimestampDateTime"")::int, 1, 0, 0, 0::double precision) = TIMESTAMP '1996-09-11 00:00:00'"); } [ConditionalTheory] @@ -515,7 +515,7 @@ await AssertQuery( AssertSql( @"SELECT e.""Id"", e.""TimestampDateTime"", e.""TimestampDateTimeArray"", e.""TimestampDateTimeOffset"", e.""TimestampDateTimeOffsetArray"", e.""TimestampDateTimeRange"", e.""TimestamptzDateTime"", e.""TimestamptzDateTimeArray"", e.""TimestamptzDateTimeRange"" FROM ""Entities"" AS e -WHERE make_timestamptz(date_part('year', e.""TimestamptzDateTime"")::INT, date_part('month', e.""TimestamptzDateTime"")::INT, 1, 0, 0, 0::double precision, 'UTC') = TIMESTAMPTZ '1998-04-01 00:00:00Z'"); +WHERE make_timestamptz(date_part('year', e.""TimestamptzDateTime"")::int, date_part('month', e.""TimestamptzDateTime"")::int, 1, 0, 0, 0::double precision, 'UTC') = TIMESTAMPTZ '1998-04-01 00:00:00Z'"); } #endregion DateTime constructors @@ -626,7 +626,7 @@ public virtual async Task Where_ConvertTimeToUtc_on_DateTime_timestamp_column() Assert.Equal(1, count); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Entities"" AS e WHERE e.""TimestampDateTime""::timestamptz = TIMESTAMPTZ '1998-04-12 13:26:38Z'"); } diff --git a/test/EFCore.PG.FunctionalTests/Query/UdfDbFunctionNpgsqlTests.cs b/test/EFCore.PG.FunctionalTests/Query/UdfDbFunctionNpgsqlTests.cs index a0bebcdbc..165a51429 100644 --- a/test/EFCore.PG.FunctionalTests/Query/UdfDbFunctionNpgsqlTests.cs +++ b/test/EFCore.PG.FunctionalTests/Query/UdfDbFunctionNpgsqlTests.cs @@ -20,7 +20,7 @@ public override void Scalar_Function_Extension_Method_Static() base.Scalar_Function_Extension_Method_Static(); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE ""IsDate""(c.""FirstName"") = FALSE"); } @@ -282,7 +282,7 @@ public override void Scalar_Function_Extension_Method_Instance() base.Scalar_Function_Extension_Method_Instance(); AssertSql( - @"SELECT COUNT(*)::INT + @"SELECT count(*)::int FROM ""Customers"" AS c WHERE ""IsDate""(c.""FirstName"") = FALSE"); } @@ -720,4 +720,4 @@ EXCEPTION WHEN OTHERS THEN private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); -} \ No newline at end of file +} diff --git a/test/EFCore.PG.NodaTime.FunctionalTests/NodaTimeQueryNpgsqlTest.cs b/test/EFCore.PG.NodaTime.FunctionalTests/NodaTimeQueryNpgsqlTest.cs index 91a4b591c..380309f14 100644 --- a/test/EFCore.PG.NodaTime.FunctionalTests/NodaTimeQueryNpgsqlTest.cs +++ b/test/EFCore.PG.NodaTime.FunctionalTests/NodaTimeQueryNpgsqlTest.cs @@ -102,7 +102,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE MAKE_INTERVAL(days => n.""LocalDate2"" - n.""LocalDate"") = INTERVAL 'P1D'"); +WHERE make_interval(days => n.""LocalDate2"" - n.""LocalDate"") = INTERVAL 'P1D'"); } [ConditionalTheory] @@ -120,7 +120,7 @@ await AssertQuery( SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE MAKE_INTERVAL(days => n.""LocalDate2"" - @__date_0) = INTERVAL 'P1D'"); +WHERE make_interval(days => n.""LocalDate2"" - @__date_0) = INTERVAL 'P1D'"); } [ConditionalTheory] @@ -135,7 +135,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE MAKE_INTERVAL(days => n.""LocalDate2"" - DATE '2018-04-20') = INTERVAL 'P1D'"); +WHERE make_interval(days => n.""LocalDate2"" - DATE '2018-04-20') = INTERVAL 'P1D'"); } [ConditionalTheory] @@ -169,7 +169,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('year', n.""LocalDateTime"")::INT = 2018"); +WHERE date_part('year', n.""LocalDateTime"")::int = 2018"); } [ConditionalTheory] @@ -184,7 +184,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('month', n.""LocalDateTime"")::INT = 4"); +WHERE date_part('month', n.""LocalDateTime"")::int = 4"); } [ConditionalTheory] @@ -199,7 +199,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('doy', n.""LocalDateTime"")::INT = 110"); +WHERE date_part('doy', n.""LocalDateTime"")::int = 110"); } [ConditionalTheory] @@ -214,7 +214,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('day', n.""LocalDateTime"")::INT = 20"); +WHERE date_part('day', n.""LocalDateTime"")::int = 20"); } [ConditionalTheory] @@ -229,7 +229,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('hour', n.""LocalDateTime"")::INT = 10"); +WHERE date_part('hour', n.""LocalDateTime"")::int = 10"); } [ConditionalTheory] @@ -244,7 +244,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('minute', n.""LocalDateTime"")::INT = 31"); +WHERE date_part('minute', n.""LocalDateTime"")::int = 31"); } [ConditionalTheory] @@ -259,7 +259,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE FLOOR(DATE_PART('second', n.""LocalDateTime""))::INT = 33"); +WHERE floor(date_part('second', n.""LocalDateTime""))::int = 33"); } [ConditionalTheory] @@ -290,8 +290,8 @@ await AssertQuery( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n WHERE CASE - WHEN FLOOR(DATE_PART('dow', n.""LocalDateTime""))::INT = 0 THEN 7 - ELSE FLOOR(DATE_PART('dow', n.""LocalDateTime""))::INT + WHEN floor(date_part('dow', n.""LocalDateTime""))::int = 0 THEN 7 + ELSE floor(date_part('dow', n.""LocalDateTime""))::int END = 5"); } @@ -349,7 +349,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('year', n.""LocalDate"")::INT = 2018"); +WHERE date_part('year', n.""LocalDate"")::int = 2018"); } [ConditionalTheory] @@ -364,7 +364,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('month', n.""LocalDate"")::INT = 4"); +WHERE date_part('month', n.""LocalDate"")::int = 4"); } [ConditionalTheory] @@ -379,7 +379,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('doy', n.""LocalDate"")::INT = 110"); +WHERE date_part('doy', n.""LocalDate"")::int = 110"); } [ConditionalTheory] @@ -394,7 +394,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('day', n.""LocalDate"")::INT = 20"); +WHERE date_part('day', n.""LocalDate"")::int = 20"); } #endregion LocalDate @@ -413,7 +413,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('hour', n.""LocalTime"")::INT = 10"); +WHERE date_part('hour', n.""LocalTime"")::int = 10"); } [ConditionalTheory] @@ -428,7 +428,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('minute', n.""LocalTime"")::INT = 31"); +WHERE date_part('minute', n.""LocalTime"")::int = 31"); } [ConditionalTheory] @@ -443,7 +443,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE FLOOR(DATE_PART('second', n.""LocalTime""))::INT = 33"); +WHERE floor(date_part('second', n.""LocalTime""))::int = 33"); } #endregion LocalTime @@ -462,7 +462,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('year', n.""Period"")::INT = 2018"); +WHERE date_part('year', n.""Period"")::int = 2018"); } [ConditionalTheory] @@ -477,7 +477,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('month', n.""Period"")::INT = 4"); +WHERE date_part('month', n.""Period"")::int = 4"); } [ConditionalTheory] @@ -492,7 +492,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('day', n.""Period"")::INT = 20"); +WHERE date_part('day', n.""Period"")::int = 20"); } [ConditionalTheory] @@ -507,7 +507,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('hour', n.""Period"")::INT = 10"); +WHERE date_part('hour', n.""Period"")::int = 10"); } [ConditionalTheory] @@ -522,7 +522,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('minute', n.""Period"")::INT = 31"); +WHERE date_part('minute', n.""Period"")::int = 31"); } [ConditionalTheory] @@ -537,7 +537,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE FLOOR(DATE_PART('second', n.""Period""))::INT = 23"); +WHERE floor(date_part('second', n.""Period""))::int = 23"); } // PostgreSQL does not support extracting weeks from intervals @@ -589,7 +589,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('year', MAKE_INTERVAL(years => n.""Id""))::INT = 1"); +WHERE date_part('year', make_interval(years => n.""Id""))::int = 1"); } [ConditionalTheory] @@ -604,7 +604,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('month', MAKE_INTERVAL(months => n.""Id""))::INT = 1"); +WHERE date_part('month', make_interval(months => n.""Id""))::int = 1"); } [ConditionalTheory] @@ -620,7 +620,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('day', MAKE_INTERVAL(weeks => n.""Id""))::INT = 7"); +WHERE date_part('day', make_interval(weeks => n.""Id""))::int = 7"); } [ConditionalTheory] @@ -635,7 +635,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('day', MAKE_INTERVAL(days => n.""Id""))::INT = 1"); +WHERE date_part('day', make_interval(days => n.""Id""))::int = 1"); } [ConditionalTheory] @@ -650,7 +650,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('hour', MAKE_INTERVAL(hours => n.""Id""))::INT = 1"); +WHERE date_part('hour', make_interval(hours => n.""Id""))::int = 1"); } [ConditionalTheory] @@ -665,7 +665,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('hour', MAKE_INTERVAL(hours => n.""Long""::INT))::INT = 1"); +WHERE date_part('hour', make_interval(hours => n.""Long""::int))::int = 1"); } [ConditionalTheory] @@ -680,7 +680,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('minute', MAKE_INTERVAL(mins => n.""Id""))::INT = 1"); +WHERE date_part('minute', make_interval(mins => n.""Id""))::int = 1"); } [ConditionalTheory] @@ -695,7 +695,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('minute', MAKE_INTERVAL(mins => n.""Long""::INT))::INT = 1"); +WHERE date_part('minute', make_interval(mins => n.""Long""::int))::int = 1"); } [ConditionalTheory] @@ -710,7 +710,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE FLOOR(DATE_PART('second', MAKE_INTERVAL(secs => n.""Id""::bigint::double precision)))::INT = 1"); +WHERE floor(date_part('second', make_interval(secs => n.""Id""::bigint::double precision)))::int = 1"); } [ConditionalTheory] @@ -725,7 +725,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE FLOOR(DATE_PART('second', MAKE_INTERVAL(secs => n.""Long""::double precision)))::INT = 1"); +WHERE floor(date_part('second', make_interval(secs => n.""Long""::double precision)))::int = 1"); } [ConditionalFact] @@ -771,7 +771,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE (DATE_PART('epoch', n.""Duration"") / 86400.0) > 27.0"); +WHERE (date_part('epoch', n.""Duration"") / 86400.0) > 27.0"); } [ConditionalTheory] @@ -786,7 +786,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE (DATE_PART('epoch', n.""Duration"") / 3600.0) < 700.0"); +WHERE (date_part('epoch', n.""Duration"") / 3600.0) < 700.0"); } [ConditionalTheory] @@ -801,7 +801,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE (DATE_PART('epoch', n.""Duration"") / 60.0) < 40000.0"); +WHERE (date_part('epoch', n.""Duration"") / 60.0) < 40000.0"); } [ConditionalTheory] @@ -816,7 +816,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('epoch', n.""Duration"") = 2365448.02"); +WHERE date_part('epoch', n.""Duration"") = 2365448.02"); } [ConditionalTheory] @@ -831,7 +831,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE (DATE_PART('epoch', n.""Duration"") / 0.001) = 2365448020.0"); +WHERE (date_part('epoch', n.""Duration"") / 0.001) = 2365448020.0"); } [ConditionalTheory] @@ -846,7 +846,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('day', n.""Duration"")::INT = 27"); +WHERE date_part('day', n.""Duration"")::int = 27"); } [ConditionalTheory] @@ -861,7 +861,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('hour', n.""Duration"")::INT = 9"); +WHERE date_part('hour', n.""Duration"")::int = 9"); } [ConditionalTheory] @@ -876,7 +876,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('minute', n.""Duration"")::INT = 4"); +WHERE date_part('minute', n.""Duration"")::int = 4"); } [ConditionalTheory] @@ -891,7 +891,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE FLOOR(DATE_PART('second', n.""Duration""))::INT = 8"); +WHERE floor(date_part('second', n.""Duration""))::int = 8"); } #endregion @@ -1235,7 +1235,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('year', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::INT = 2018"); +WHERE date_part('year', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::int = 2018"); } [ConditionalTheory] @@ -1250,7 +1250,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('month', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::INT = 4"); +WHERE date_part('month', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::int = 4"); } [ConditionalTheory] @@ -1265,7 +1265,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('doy', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::INT = 110"); +WHERE date_part('doy', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::int = 110"); } [ConditionalTheory] @@ -1280,7 +1280,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('day', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::INT = 20"); +WHERE date_part('day', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::int = 20"); } @@ -1296,7 +1296,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('hour', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::INT = 10"); +WHERE date_part('hour', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::int = 10"); } @@ -1312,7 +1312,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE DATE_PART('minute', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::INT = 31"); +WHERE date_part('minute', n.""ZonedDateTime"" AT TIME ZONE 'UTC')::int = 31"); } [ConditionalTheory] @@ -1327,7 +1327,7 @@ await AssertQuery( AssertSql( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n -WHERE FLOOR(DATE_PART('second', n.""ZonedDateTime"" AT TIME ZONE 'UTC'))::INT = 33"); +WHERE floor(date_part('second', n.""ZonedDateTime"" AT TIME ZONE 'UTC'))::int = 33"); } [ConditionalTheory] @@ -1358,8 +1358,8 @@ await AssertQuery( @"SELECT n.""Id"", n.""DateInterval"", n.""Duration"", n.""Instant"", n.""InstantRange"", n.""Interval"", n.""LocalDate"", n.""LocalDate2"", n.""LocalDateRange"", n.""LocalDateTime"", n.""LocalTime"", n.""Long"", n.""OffsetTime"", n.""Period"", n.""TimeZoneId"", n.""ZonedDateTime"" FROM ""NodaTimeTypes"" AS n WHERE CASE - WHEN FLOOR(DATE_PART('dow', n.""ZonedDateTime"" AT TIME ZONE 'UTC'))::INT = 0 THEN 7 - ELSE FLOOR(DATE_PART('dow', n.""ZonedDateTime"" AT TIME ZONE 'UTC'))::INT + WHEN floor(date_part('dow', n.""ZonedDateTime"" AT TIME ZONE 'UTC'))::int = 0 THEN 7 + ELSE floor(date_part('dow', n.""ZonedDateTime"" AT TIME ZONE 'UTC'))::int END = 5"); }