Menu

#621 Integer overflow PostgreSQL Delphi 2009

8.0.0
open
nobody
None
Bug Report
2025-02-14
2025-02-07
Paulina
No

Hi,

I have problem with query with parameters, it is generating integer overflow error. I'm using Delphi 2009, PostgreSQL 14.
I've tried the same code with Delphi 11 and 7.2.4-stable and it is working.

    db.connect;
    qr := TZQuery.Create(self);
    try
        qr.Connection := db;
        qr.ParamCheck := true;

        zap := 'insert into tab.monitoring(opis) values('+
                ':param_opis)';

        qr.SQL.Add(zap);
        qr.Params.CreateParam(ftString, 'param_opis', ptInput);
        qr.Params.ParamByName('param_opis').AsString := 'blblblb';
        try
            qr.ExecSQL;
        except

        end;
    finally
        qr.Free;
    end;

In the attachment is the demo project.

1 Attachments

Discussion

  • Paulina

    Paulina - 2025-02-07

    I know what is wrong. There should be:

    qr.Params.CreateParam(ftString, 'param_opis', ptInput);
    qr.SQL.Add(zap);

    I didn't know order is important in this case. So there is a workaround, but in my opinion this error is a bug.

     
  • Nick Nevzorov

    Nick Nevzorov - 2025-02-14

    Why do you doing CreateParam? It creates automatically, after SQL.add. Try remove shis line:

    qr.Params.CreateParam(ftString, 'param_opis', ptInput);

     

Log in to post a comment.

MongoDB Logo MongoDB