pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Luciano <ldelio@yahoo.com>
Cc: pgsql-odbc@postgresql.org
Subject: Re: Query with hexadecimal characters
Date: Mon, 10 Jan 2005 18:05:20 -0500
Message-ID: <9595.1105398320@sss.pgh.pa.us> (raw)
In-Reply-To: <20050110221036.62433.qmail@web53703.mail.yahoo.com>
References: <20050110221036.62433.qmail@web53703.mail.yahoo.com>

Luciano <ldelio@yahoo.com> writes:
> I am having a problem doing a query with hexadecimal
> characters through ODBC. The hexadecimal characters
> are inside a character filed. It would be something
> like:

> SELECT * FROM MYTABLE WHERE COLUMN1 < 'XXXXXX'

> but instead of the X's there are x'FF' characters...
> The query is accepted, but the result is not
> consistent... it returns an empty result set. Does
> anyone know if I'm missing something?

I suspect you are spitting byte sequences at the backend that are
illegal in the character set encoding you've selected.  Check your
locale and database encoding setup.  C/SQL_ASCII is the best bet
if you want to pretend that you can store any random byte sequence
in a character field.

Plan B, which would probably be better in the long run, is to store
that data in a bytea field instead, and send escaped characters
(ie \\377 rather than an actual FF byte).

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <9595.1105398320@sss.pgh.pa.us>
Permalink:  ../9595.1105398320@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9595.1105398320@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, ldelio@yahoo.com
  Subject: Re: Query with hexadecimal characters
  In-Reply-To: <9595.1105398320@sss.pgh.pa.us>
  References: <20050110221036.62433.qmail@web53703.mail.yahoo.com> <9595.1105398320@sss.pgh.pa.us>

* 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