I am trying to track down the difference between the way select is working on two different installations of Postgresql. One is 9.3 on Windows with SQL_ASCII encoding. The other is 9.3 on Linux with SQL_ASCII encoding.
The issue revolves around how select is handling character fields with leading spaces. The following commands are done in both regions with 2 different sets of results:
Windows
create table jb (jb1 character(3));
insert into jb values('010');
insert into jb values(' 1');
insert into jb values('999');
select * from jb where jb1 between ' 1' and '999';
Results: 010,1,999
Linux
create table jb (jb1 character(3));
insert into jb values('010');
insert into jb values(' 1');
insert into jb values('999');
select * from jb where jb1 between ' 1' and '999';
Results: 1,99
My best explanation is that the Linux installation is inherently removing all leading spaces within the SQL query... I do not, however, understand why this would be and how to overcome it. There are millions of legacy rows involved with foreign keys against dozens of other tables.
Input is appreciated.