Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-08

Postgresql error

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Koenraad Lelong

Hi,

I can't find out why I get this error in my application : EPQDatabase Error
pqMyServer1 : Preparation of query failed (PostgreSQL:ERROR: prepared statement "prepst0" already exists)
Severity : ERROR
SQL State : 42P05

I'm using a TPQConnection, and I can make it active. My TSQLQuery.SQL (pqQuery2) is this :
UPDATE mydbcarrview_10.carrier_magname
SET location = :location
where carrierid = :carrierid

Then I do this :

  with Datamodule1 do
   begin
//    pqQuery2.UnPrepare; <-- does not help
     pqQuery2.ParamByName('Location').AsString:=edtLocation.Text;
     pqQuery2.ParamByName('CarrierId').AsString:=edtCarrierId.Text;
     try
       pqQuery2.ExecSQL; <-- gives the error
       pgTransaction1.Commit;
     except
       on e:exception do
        begin
         showmessage(e.Message);
         pgTransaction1.Rollback;
        end;
     end;
   end;

pqQuery2.UpdateMode was UpWhereKeyOnly, and I tried UpWhereAll, with the same error as result.

Lazarus 1.08, fpc 2.6.2 on winXP-32 bit.

What am I doing wrong ?

Thanks,

Koenraad Lelong

Reply by email

Koenraad Lelong
to Koenraad Lelong
Koenraad Lelong wrote 9 lines
Hi, I can't find out why I get this error in my application : EPQDatabase Error pqMyServer1 : Preparation of query failed (PostgreSQL:ERROR: prepared statement "prepst0" already exists) Severity : ERROR SQL State : 42P05

Hi,

The problem is solved. To my shame I used the wrong transaction for the query. And I didn't see this until after a few hours of debugging.

Regards,

Koenraad Lelong

Reply by email