Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VjrmU-00080G-9T for pgsql-odbc@arkaria.postgresql.org; Fri, 22 Nov 2013 14:32:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VjrmT-00004t-Ow for pgsql-odbc@arkaria.postgresql.org; Fri, 22 Nov 2013 14:32:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VhmMm-0002tF-OE for pgsql-odbc@postgresql.org; Sat, 16 Nov 2013 20:21:16 +0000 Received: from fw.sss.co.nz ([202.36.44.242] helo=smtp02.local) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VhmMg-0002UU-DJ for pgsql-odbc@postgresql.org; Sat, 16 Nov 2013 20:21:14 +0000 Message-ID: <5287D1A4.2020906@securitease.com> Date: Sat, 16 Nov 2013 21:12:20 +0100 From: Keri Harris MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: Prepared statement with bytea domain cannot be executed with BoolsAsChars=1 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org I've run into an instance where executing a prepared statement when BoolsAsChars=1 is set returns the error: ERROR: ODBC: State S1000: Could not convert binary other than LO type The setup is having a table containing two columns: * one column has a bytea domain * another column is of type VARCHAR of exactly 5 characters CREATE DOMAIN my_bytea_domain AS bytea; CREATE TABLE my_table ( my_binary_column my_bytea_domain, my_varchar_column varchar(5) ); The error triggers when executing a prepared statement of the form: SELECT * FROM my_table WHERE 'my_varchar_column' = ? AND 'my_binary_column' = ? Under the above conditions, HowToPrepareBeforeExec() returns shouldParse. This causes prepareParameters() to call SendSyncAndReceive() which in turn calls PIC_set_pgtype() setting .PGType to my_bytea_domain for the binary parameter. Eventually when ResolveOneParam() calls PIC_dsp_pgtype() on the binary parameter, .PGType is already set to a non-NULL value, so is not set to PG_TYPE_BYTEA. Thanks Keri -- _____________________________________________ Keri Harris Software Engineer SecuritEase Tel: +64 4 917-6670 Fax: +64 4 917-6671 E-mail: keri.harris@securitease.com Visit us at: http://www.securitease.com _____________________________________________ This e-mail passed our content security scan. It is covered by the confidentiality clauses at http://www.securitease.com/content_and_confidentiality -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc