CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
serkan

CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists

Post by serkan » Fri 18 Mar 2005 11:21

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?

Yuri
Posts: 140
Joined: Mon 08 Nov 2004 12:07

CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists

Post by Yuri » Fri 18 Mar 2005 12:16

Which version of PostgreSQLDirect do you use?

serkan

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

Post by serkan » Fri 18 Mar 2005 12:19

Yuri wrote:Which version of PostgreSQLDirect do you use?
I use PostgreSQLDirect .NET Standard 2.0.2.0

Yuri
Posts: 140
Joined: Mon 08 Nov 2004 12:07

CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists

Post by Yuri » Fri 18 Mar 2005 12:31

Please provide us sample code that reproduces the error.

serkan

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

Post by serkan » Fri 18 Mar 2005 13:58

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


serkan

Any suggestions?

Post by serkan » Fri 18 Mar 2005 19:50

Help about this issue is needed urgently...

What should I do?

Yuri
Posts: 140
Joined: Mon 08 Nov 2004 12:07

Any suggestions?

Post by Yuri » Mon 21 Mar 2005 15:37

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.

Yuri
Posts: 140
Joined: Mon 08 Nov 2004 12:07

Any suggestions?

Post by Yuri » Thu 31 Mar 2005 08:22

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.

Post Reply