CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists
CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists
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 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
Which version of PostgreSQLDirect do you use?
Re: CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists
I use PostgreSQLDirect .NET Standard 2.0.2.0Yuri wrote:Which version of PostgreSQLDirect do you use?
CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists
Please provide us sample code that reproduces the error.
Re: CoreLab.PostgreSql.PgSqlException: prepared statement PRSTMTXXX already exists
It took a lot time to prepare the code that reproduces the error and also it looks stupid but finally I got it.Yuri wrote:Please provide us sample code that reproduces the error.
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?
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.
As soon as we solve the problem, we'll let you know.
Any suggestions?
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.