From f679f71ceda89e7761f23c54970191958d494962 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sun, 28 Aug 2022 20:36:24 +0800 Subject: [PATCH] Update exp to sql --- .../SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs | 4 ++++ .../SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs | 4 ++++ 2 files changed, 8 insertions(+) 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();