diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs index 8025ea004..6a5f2d181 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs @@ -61,6 +61,10 @@ namespace SqlSugar { return (HasWhere?"AND":"WHERE")+ " ROWNUM=1"; } + else if (this.Context is PostgreSQLExpressionContext) + { + return "limit 1"; + } else if (this.Context.GetLimit()!=null) { return this.Context.GetLimit(); diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs index 8025ea004..6a5f2d181 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs @@ -61,6 +61,10 @@ namespace SqlSugar { return (HasWhere?"AND":"WHERE")+ " ROWNUM=1"; } + else if (this.Context is PostgreSQLExpressionContext) + { + return "limit 1"; + } else if (this.Context.GetLimit()!=null) { return this.Context.GetLimit();