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

BUG #3002: PQexecParams only supports some commands; needs improved error reporting, documenting or fixing

From: "Phil Endecott" <spam_from_postgresql_bugs(at)chezphil(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3002: PQexecParams only supports some commands; needs improved error reporting, documenting or fixing
Date: 2007-02-13 19:39:36
Message-ID: 200702131939.l1DJda97027619@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      3002
Logged by:          Phil Endecott
Email address:      spam_from_postgresql_bugs(at)chezphil(dot)org
PostgreSQL version: 8.1.0
Operating system:   All?
Description:        PQexecParams only supports some commands; needs improved
error reporting, documenting or fixing
Details: 

I understand that PQexecParams may only be used for SELECT, INSERT, DELETE
and UPDATE commands, but not for other commands where parameter substitution
might be useful such as CREATE VIEW and CREATE TABLE AS SELECT.  When I used
PQexecParams with CREATE VIEW with one $ parameter I got no error
immediately, but got a "no value found for parameter 1" error when I later
ran a query that used the view.

Three fixes occur to me:

1. An error could be reported immediately if an unsupported command is
passed to PQexecParams.

2. The documentation of PQexecParams could be fixed to list the four
commands to which it can be applied.

3. PQexecParams could be extended to support these commands.  I have written
a simple wrapper for PQexecParams that expands and escapes parameters and
calls PQexec, for a small set of parameter types.  (Please ask me if you'd
like to see the code; it is only 30 lines of obviousness.)  Presumably this
would be even simpler if done in the backend.

Thanks, Phil.

Responses

pgsql-bugs by date

Next:From: roland diazDate: 2007-02-13 23:42:23
Subject: BUG #3005: please help
Previous:From: laurent faillieDate: 2007-02-13 10:42:45
Subject: BUG #3000: Linking problem

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