Skip site navigation (1) Skip section navigation (2)

BUG #2629: libpq - Cannot deallocate prepared statement created with PQprepare()

From: "Andy McCurdy" <andy(dot)mccurdy(at)emergent(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2629: libpq - Cannot deallocate prepared statement created with PQprepare()
Date: 2006-09-15 07:39:32
Message-ID: 200609150739.k8F7dWcw087917@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      2629
Logged by:          Andy McCurdy
Email address:      andy(dot)mccurdy(at)emergent(dot)net
PostgreSQL version: 8.1.4
Operating system:   Windows XP
Description:        libpq - Cannot deallocate prepared statement created
with PQprepare()
Details: 

According to http://www.postgresql.org/docs/8.1/interactive/libpq-exec.html,
the last statement in the PQprepare() function description suggests that a
user can run the statement: "DEALLOCATE [statement name]" with PQexec() to
deallocate a statement prepared with PQprepare().  When trying to do this, I
consistently get the error message:

ERROR:  prepared statement "[statement name]" does not exist

Here's a snippet of code that illustrates what I am attempting to do:

int main()
{

PGconn* conn;
PGresult* result;

conn = PQsetdbLogin("localhost", "5432", NULL, NULL, "postgres", "postgres",
"postgres");

result = PQprepare(conn, "MyQuery", "select * from pg_stat_activity", 0,
NULL);

/* 
THE FOLLOW PQEXEC() FAILS.  Error message says:  ERROR:  prepared statement
"myquery" does not exist"
*/
result = PQexec(conn, "DEALLOCATE MyQuery");


result = PQexec(conn, "PREPARE MyQuery AS select * from pg_stat_activity");

/*
THIS WORKS
*/
result = PQexec(conn, "DEALLOCATE MyQuery");



return 0;
}

Responses

pgsql-bugs by date

Next:From: Schoenen, HolgerDate: 2006-09-15 13:07:00
Subject: backup + restore fails
Previous:From: Euler Taveira de OliveiraDate: 2006-09-15 04:09:50
Subject: Re: wrong behavior using to_char()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group