Lazarus. DBGrid shows number 1 as 822083524 from PostgreSQL with DO $$ block lazarus / 16-Databases ---------------------------------------------------------------------- alexanplaz · 2022-11-06 11:45 SQLQuery.Text=' DO $$ begin end $$; select 1;' SQLQuery.Open; As a query result  in DBGrid I see 822083524. Why ? DBeaver and Psql  show normal numer 1. Addition: SQLQuery.Text='DO $$ begin end $$; select 1.123;' SQLQuery.Open; Result is: Floating point overflow. Lazarus 2.2.4 (rev lazarus_2_2_4) FPC 3.2.2 x86_64-win64-win32/win64 PostgreSQL 14.5 ---------------------------------------------------------------------- MarkMLl · 2022-11-06 12:13 Attach a compilable program that demonstrates the problem. MarkMLl ---------------------------------------------------------------------- alexanplaz · 2022-11-06 12:23 Full SQLQuery.Text= do $$ declare i int; begin  i=1; end $$; select 1; If SQLQuery.Text='select 1;'  then result is 1. But if SQLQuery.Text contains postgresql block do$$, then there is that problem. ---------------------------------------------------------------------- MarkMLl · 2022-11-06 12:33 That is not a valid Pascal program. Post something that other members of the forum can run through a compiler, or we will not be able to help you. However I'd add that I'm not sure that I've seen anybody attempting to define inline SQL like that (i.e. rather than a single query)... I'm not saying that it won't work, but that it should probably be your first suspect. MarkMLl ---------------------------------------------------------------------- alexanplaz · 2022-11-06 12:39 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button2Click(Sender: TObject);beginwith SQLQuery1 do begin  SQL.Add('do $$');  SQL.Add('declare i int;');  SQL.Add('begin');  SQL.Add('  i=22222;');  SQL.Add('end $$;');  SQL.Add('select 1;'); end;   SQLQuery1.Close;  SQLQuery1.Open;end;  As a result I see one row, one column with 822083524 value. Without block do$$  I see normal 1. ---------------------------------------------------------------------- Martin_fr · 2022-11-06 14:02 Not relevant to your question, but please use [ code ] tags in future. Thanks (Edited your post, and added them) ---------------------------------------------------------------------- gucao · 2022-11-08 03:22 chang the code can avoid this problem. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button2Click(Sender: TObject);beginwith SQLQuery1 do begin    Active:=False;    SQL.Clear;    SQL.Add('do $$');    SQL.Add('declare i int;');    SQL.Add('begin');    SQL.Add('  i=22222;');    SQL.Add('end $$;');    ExecSQL;    //here mybe need SQLTransaction.Commit;    Active:=False;    SQL.Clear;     SQL.Add('select 1;');    Open; end;end;