Prepared statement with bytea domain cannot be executed with BoolsAsChars=1

From: Keri Harris <keri(dot)harris(at)securitease(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Prepared statement with bytea domain cannot be executed with BoolsAsChars=1
Date: 2013-11-16 20:12:20
Message-ID: 5287D1A4.2020906@securitease.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

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(dot)harris(at)securitease(dot)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

Browse pgsql-odbc by date

  From Date Subject
Next Message Przemyslaw Rzepecki 2013-11-17 16:25:16 SQLCopyDesc to copy rows between tables
Previous Message Nick Gorham 2013-11-13 11:12:17 Re: Is the linking with -lodbc necessary? (--with-odbc)