From 0a04bfbb9ff60fa7905f54d1175ad25a2c3d3b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Wed, 23 Aug 2023 19:57:10 +0200 Subject: [PATCH] DataSource: Fix Find() method on PostgreSQL, that requires sub-query aliases even if the alias is not needed! [GB.DB.FORM] * BUG: DataSource: Fix Find() method on PostgreSQL, that requires sub-query aliases even if the alias is not needed! --- comp/src/gb.db.form/.src/DataTable.class | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comp/src/gb.db.form/.src/DataTable.class b/comp/src/gb.db.form/.src/DataTable.class index f74698c98..dfd8fdd33 100644 --- a/comp/src/gb.db.form/.src/DataTable.class +++ b/comp/src/gb.db.form/.src/DataTable.class @@ -173,7 +173,7 @@ Public Sub Find(sWhere As String, Optional iFrom As Integer) As Integer sSelect = "ROW_NUMBER() OVER (" & $DB.SQL.OrderBy(GetSortKeys())() & ") AS __index" sReq = $DB.SQL.Select([sSelect, "*"]).From($sTable).Where($sFilter)() - sReq = "SELECT * FROM (" & sReq & ") WHERE " & sWhere + sReq = "SELECT * FROM (" & sReq & ") AS __pg_sucks WHERE " & sWhere If iFrom > 0 Then sReq &= " AND __index >= " & CStr(iFrom + 1) rFind = $DB.Limit(1).Exec(sReq)