Inconsistent results from HEX values in predicates

Поиск
Список
Период
Сортировка
От Gary Cowell
Тема Inconsistent results from HEX values in predicates
Дата
Msg-id CAMC0u8nbofwOq3cCFPvo1cyF0QFW8YaSxAS_oYE3rV8Pz+Ho_g@mail.gmail.com
обсуждение исходный текст
Ответы Re: Inconsistent results from HEX values in predicates  (Gary Cowell <gary.cowell+pgsql@gmail.com>)
Re: Inconsistent results from HEX values in predicates  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hello

I have a table, and I want to always supply predicates in a BETWEEN format.

If all data is to be returned, then the FROM and TO values of the
BETWEEN are set to low hex value, and high hex value.

Sometimes this is not returning rows, here's an example:

e5iso=# create table t1 (col1 character(3));
CREATE TABLE
e5iso=# insert into t1 values('AAA');
INSERT 0 1
e5iso=# insert into t1 values('000');
INSERT 0 1
e5iso=# insert into t1 values('   ');
INSERT 0 1
e5iso=# insert into t1 values(' x ');
INSERT 0 1
e5iso=# select  col1 from t1 where col1 BETWEEN E'\x01\x01\x01' AND
E'\xFF\xFF\xFF' ;
 col1
------
 AAA
 000
  x
(3 rows)

So where did my '   ' row go?

Am I missing something, are SPACES special in some way?

e5iso=# select * from t1 where col1 is null;
 col1
------
(0 rows)


All my rows hex values:

e5iso=# select encode(col1::bytea,'hex') from t1;
 encode
--------
 414141
 303030
 202020
 207820


The database is a LATIN9 database.

Help please!


В списке pgsql-general по дате отправления:

Предыдущее
От: Albe Laurenz
Дата:
Сообщение: Re: NEW in after insert trugger contained incorrect data
Следующее
От: Gary Cowell
Дата:
Сообщение: Re: Inconsistent results from HEX values in predicates