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

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

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Andy McCurdy <andy(dot)mccurdy(at)emergent(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2629: libpq - Cannot deallocate prepared statement created with PQprepare()
Date: 2006-09-16 13:08:17
Message-ID: 20060916130817.GA89795@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-bugs
On Fri, Sep 15, 2006 at 07:39:32AM +0000, Andy McCurdy wrote:
> 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");

You prepared a mixed-case identifier so you'll need to quote it in
SQL statements to preserve its case.  Unquoted identifiers are
folded to lowercase, as the error message shows.

result = PQexec(conn, "DEALLOCATE \"MyQuery\"");

See "Identifiers and Key Words" in the "SQL Syntax" chapter of the
documentation for more information about quoted identifiers.

http://www.postgresql.org/docs/8.1/interactive/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS

-- 
Michael Fuhr

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2006-09-16 13:28:40
Subject: Re: BUG #2629: libpq - Cannot deallocate prepared statement created with PQprepare()
Previous:From: Magnus HaganderDate: 2006-09-16 12:52:49
Subject: Re: BUG #2630: Can't unpack

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