possible bug in case comparison on index scan.

"Merlin Moncure" <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.general,gmane.comp.db.postgresql.devel.win32
Message-ID <[email protected]>
I've uncovered a possible bug on that may be related to the other locale
relation issues for win32 being discussed right now.  Basically, I have
a situation where a query is pulling up the wrong record based on string
case.  So far, I have not been able to reproduce this in linux.

Here is the situation:
Database is initialized to the default locale which is  "English_United
States.1252" (as reported by pg_controldata.exe).  Databases initialized
to the 'C' locale don't have this problem.  If this is just a locale
issue, I'm not concerned (just use the C locale), but just want to make
sure a btree related issue is not slipping through.

Observe:

esp=# select version();
                                           version
------------------------------------------------------------------------
---------------------
 PostgreSQL 8.0.0rc2 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC)
3.4.1 (mingw special)
(1 row)

esp=# prepare data9_start_nl_item_base_file_5 (character varying,
character varying, int4)
esp-#   as select 1::int4, ib_sales_description_1 from
data9.item_base_file
esp-#   where ib_sales_description_1 >= $1 and
esp-#           (ib_sales_description_1 >  $1 or  ib_sales_description_2
>= $2)
esp-#   order by ib_sales_description_1, ib_sales_description_2, id
esp-#   limit $3;
PREPARE
esp=# execute data9_start_nl_item_base_file_5('SAT', '', 1 );
 int4 | ib_sales_description_1
------+------------------------
    1 | satellite
(1 row)

esp=# select 'sat' >= 'SAT';
 ?column?
----------
 f
(1 row)

esp=# execute data9_start_nl_item_base_file_5('SAT', '', 2 );
 int4 |    ib_sales_description_1
------+-------------------------------
    1 | satellite
    1 | SATELLITE (current) AUTO DUAL
(2 rows)

Merlin

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.