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;