Page 1 of 1

CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists

Posted: Fri 18 Mar 2005 11:21
by serkan
When a simple sql is executed repeatedly in a loop, after a short time pgSql throws an exception:

CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMT21446312355737921 already exists

I assume that when the PgSqlCommand is about to run, it first prepare the the command and assigns a random name like PRSTMTXXXX and then executes it.

If I am not mistaken, this XXXX part matches with some previous command and this exception is thrown.

What should I do?

CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists

Posted: Fri 18 Mar 2005 12:16
by Yuri
Which version of PostgreSQLDirect do you use?

Re: CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists

Posted: Fri 18 Mar 2005 12:19
by serkan
Yuri wrote:Which version of PostgreSQLDirect do you use?
I use PostgreSQLDirect .NET Standard 2.0.2.0

CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists

Posted: Fri 18 Mar 2005 12:31
by Yuri
Please provide us sample code that reproduces the error.

Re: CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists

Posted: Fri 18 Mar 2005 13:58
by serkan
Yuri wrote:Please provide us sample code that reproduces the error.
It took a lot time to prepare the code that reproduces the error and also it looks stupid but finally I got it.

Code: Select all

Create Table

CREATE TABLE dummytable
(
  dummyfield1 int4 NOT NULL,
  dummyfield2 int4 NOT NULL
 ) 

Code: Select all

VB Code

        For index As Integer = 0 To 1
            For dummyIndex1 As Integer = 1 To 5
                For dummyIndex2 As Integer = 1 To 9
                    Dim pgSqlConnection As New PgSqlConnection("Host=localhost;Port=5432;User=xxx;Password=xxx;Database=OkulNET;")
                    Dim pgSqlCommand As PgSqlCommand = pgSqlConnection.CreateCommand

                    pgSqlConnection.Open()
                    pgSqlCommand.Connection = pgSqlConnection
                    pgSqlCommand.CommandText = "Delete From dummytable Where dummyfield1=0 AND dummyfield2=" & (dummyIndex1 - 1) * 9 + dummyIndex2
                    pgSqlCommand.ExecuteNonQuery()

                    pgSqlConnection.Close()
                Next
            Next
        Next


Any suggestions?

Posted: Fri 18 Mar 2005 19:50
by serkan
Help about this issue is needed urgently...

What should I do?

Any suggestions?

Posted: Mon 21 Mar 2005 15:37
by Yuri
We got your request and now examine the problem. Unfortunately now we couldn't give you any information.
As soon as we solve the problem, we'll let you know.

Any suggestions?

Posted: Thu 31 Mar 2005 08:22
by Yuri
Unfortunately we couldn't reproduce the problem. Try to download the new version from our site. Could you reproduce the problem with the last version of the provider? As a temporary solution you can use text protocol setting "protocol=2;" option at your ConnectionString.