pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Keri Harris <keri.harris@securitease.com>
To: pgsql-odbc@postgresql.org
Subject: Prepared statement with bytea domain cannot be executed with BoolsAsChars=1
Date: Sat, 16 Nov 2013 21:12:20 +0100
Message-ID: <5287D1A4.2020906@securitease.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.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



Message-ID: <5287D1A4.2020906@securitease.com>
Permalink:  ../5287D1A4.2020906@securitease.com/
Also on:    postgresql.org/message-id/5287D1A4.2020906@securitease.com

 · 

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: keri.harris@securitease.com
  Subject: Re: Prepared statement with bytea domain cannot be executed with BoolsAsChars=1
  In-Reply-To: <5287D1A4.2020906@securitease.com>
  References: <5287D1A4.2020906@securitease.com>

* 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