X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5201853CFA for ; Wed, 11 May 2005 12:15:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28230-07 for ; Wed, 11 May 2005 15:15:35 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by svr1.postgresql.org (Postfix) with ESMTP id 99E7E53BE8 for ; Wed, 11 May 2005 12:15:32 -0300 (ADT) Received: from isi-dsl-103-4.isionline-dialin.de[213.128.103.4] (helo=gormenghast) by mrelayeu.kundenserver.de with ESMTP (Nemesis), id 0MKxQS-1DVsvf3pqr-0001UF; Wed, 11 May 2005 17:15:19 +0200 Cc: info@egenix.com To: pgsql-odbc@postgresql.org Subject: Problem with bound parameters From: charlie clark Content-Type: text/plain; format=flowed; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Wed, 11 May 2005 17:14:45 +0200 Message-ID: User-Agent: Opera7.23/Win32 M2 build 3227 X-Provags-ID: kundenserver.de abuse@kundenserver.de login:8c2a76220e21e6d701ad8ab7dcd4a511 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200505/29 X-Sequence-Number: 5332 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 "", 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