pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: charlie clark <charlie@begeistert.org>
To: pgsql-odbc@postgresql.org
Cc: info@egenix.com
Subject: Problem with bound parameters
Date: Wed, 11 May 2005 17:14:45 +0200
Message-ID: <opsql9yvntyt02yl@mail.isis.de> (raw)

Dear all,

I've hit upon a problem using bound parameters with pgsql-ODBC and strings 
containing newlines ("\n"). I'm using PostgreSQL 8.0 rc1 and pgsql-ODBC 
8.0.01.01 with Python 2.3 and mxODBC 1.08. It looks like the parameter is 
being incorrectly quoted by the pgODBC driver.

This is from the command line

problem = """The partition you have selected is resizable, the installer 
has chosen a reasonable size for splitting the available space.

You may select your own size by dragging the splitter, or typing in a size 
in Megabytes.

You may also choose to use the entire partition for ZETA."""
>>> c.execute("""SELECT content FROM localekit
                 INNER JOIN localekit_attributes AS attr ON
                 (attr.id = localekit.id_attribute)
                 WHERE
                 locale = 'enUS'
                 AND attribute = ?
                 AND application = ?""", (problem, 'Installer'))

Traceback (most recent call last):
   File "<pyshell#22>", line 1, in -toplevel-
     c.execute("""SELECT content FROM localekit
ProgrammingError: ('HY000', 7, 'ERROR:  type "lo" does not exist', 5898)
>>> c.execute("""SELECT content FROM localekit
                 INNER JOIN localekit_attributes AS attr ON
                 (attr.id = localekit.id_attribute)
                 WHERE
                 locale = 'enUS'
                 AND attribute = '%s'
                 AND application = '%s'""" %(problem, 'Installer'))

The first example raises the error for the incorrect type:
conn=36387816, query='select oid from pg_type where typname='lo''
     [ fetched 0 rows ]

Which means that the statement is being corrupted somehow.

In the second example the quoting is done directly in Python and no error 
is raised.

Is it not advisable to use bound parameters with pgsql-ODBC?

Thanks for any help

Charlie

-- 
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D-40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



Message-ID: <opsql9yvntyt02yl@mail.isis.de>
Permalink:  ../opsql9yvntyt02yl@mail.isis.de/
Also on:    postgresql.org/message-id/opsql9yvntyt02yl@mail.isis.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: charlie@begeistert.org, info@egenix.com
  Subject: Re: Problem with bound parameters
  In-Reply-To: <opsql9yvntyt02yl@mail.isis.de>
  References: <opsql9yvntyt02yl@mail.isis.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox