From 6e4de241a51c319b295758ee3a7fe39ae541b9eb Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 26 Aug 2014 18:04:35 +0000 Subject: [PATCH] Fix UPDATE + DELETE queries in data grid for PostgreSQL, which do not support a LIMIT clause. --- source/dbconnection.pas | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/dbconnection.pas b/source/dbconnection.pas index 5ebded32..5046cb73 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -4681,9 +4681,12 @@ begin Result := Result + IntToStr(Limit); end; ngPgSQL: begin - Result := Result + QueryBody + ' LIMIT ' + IntToStr(Limit); - if Offset > 0 then - Result := Result + ' OFFSET ' + IntToStr(Offset); + if QueryType = 'SELECT' then begin + Result := Result + QueryBody + ' LIMIT ' + IntToStr(Limit); + if Offset > 0 then + Result := Result + ' OFFSET ' + IntToStr(Offset); + end else + Result := Result + QueryBody; end; end; end;