Thread: Unexplained case insensitive results

Unexplained case insensitive results

From
"Lloyd Mason"
Date:

There appears to be a difference in the results from the following SQL statement when run on an 8.1.5 version versus a 8.1.8 version:

SELECT T1.MRPtPro AS MRPtPro, T1.MRPtDOB, T1.MRPtSSN, T1.MRPtNbr, T2.MRMDNam AS MRPtProN, T1.MRPtChtCmpFlg, T1.MRPtPhA, T1.MRPtPhP, T1.MRPtPhS, T1.MRPtFNam, T1.MRPtLNam, T1.MRPtSts, T1.PrtNbr FROM (MR0011 T1 LEFT JOIN MR00051 T2 ON T2.PrtNbr = T1.PrtNbr AND T2.MRMDNbr = T1.MRPtPro) WHERE (T1.PrtNbr = 1 and T1.MRPtSts = 'A' and T1.MRPtLNam >= 'person                        ') AND (T1.MRPtLNam < 'persoo                        ') ORDER BY T1.PrtNbr, T1.MRPtSts,

T1.MRPtLNam, T1.MRPtFNam

 

The column MRPtLAN has both upper and lower case data.

 

The 8.1.5 version shows all matches both upper and lower case.  While the 8.1.8 version shows only those entries that are lower case.  Any ideas as to why this is? 

 

We would like it to show all matches (case-insensitive) that are returned in 8.1.5 but would like to be on a newer version of the database 8.1.8 and eventually 8.2.X.

 

Both databases are UTF-8 encoding and running on REDHAT EL 4.0.  Both databases were created from a pg_dump that came out of a 7.4.5 version of Postgresql with SQL_ASCII encoding.  I don’t think the encoding should matter but included it for your review.

 

Re: Unexplained case insensitive results

From
Tom Lane
Date:
"Lloyd Mason" <LloydM@pbsinet.com> writes:
> There appears to be a difference in the results from the following SQL
> statement when run on an 8.1.5 version versus a 8.1.8 version:

I imagine you initdb'd the two installations with different locale
settings.  Check "show lc_collate".

            regards, tom lane

Re: Unexplained case insensitive results

From
"Carlos Oliva"
Date:

Hi Lloyd,

Please ignore searches on names that are in lower case.  The PBSI-EMR will search only on first and last names that are in upper case.  In this way, we are synchronized with PBSI-DOC which uses and sends only upper case names, and we avoid searching problems.  Teresa and I have discussed adding extra fields to the patient tables in which the users can enter names with any capitalization that they wish to use.  These will be the names that they will see on the screen but the queries and searches will be done on the upper case names.  I have discussed this with Graydon and Teresa several times in the past two years so you may I prefer that to postpone the research on this and devote your energies to other endeavors.

 


From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Lloyd Mason
Sent: Friday, March 30, 2007 4:44 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Unexplained case insensitive results

 

There appears to be a difference in the results from the following SQL statement when run on an 8.1.5 version versus a 8.1.8 version:

SELECT T1.MRPtPro AS MRPtPro, T1.MRPtDOB, T1.MRPtSSN, T1.MRPtNbr, T2.MRMDNam AS MRPtProN, T1.MRPtChtCmpFlg, T1.MRPtPhA, T1.MRPtPhP, T1.MRPtPhS, T1.MRPtFNam, T1.MRPtLNam, T1.MRPtSts, T1.PrtNbr FROM (MR0011 T1 LEFT JOIN MR00051 T2 ON T2.PrtNbr = T1.PrtNbr AND T2.MRMDNbr = T1.MRPtPro) WHERE (T1.PrtNbr = 1 and T1.MRPtSts = 'A' and T1.MRPtLNam >= 'person                        ') AND (T1.MRPtLNam < 'persoo                        ') ORDER BY T1.PrtNbr, T1.MRPtSts,

T1.MRPtLNam, T1.MRPtFNam

 

The column MRPtLAN has both upper and lower case data.

 

The 8.1.5 version shows all matches both upper and lower case.  While the 8.1.8 version shows only those entries that are lower case.  Any ideas as to why this is? 

 

We would like it to show all matches (case-insensitive) that are returned in 8.1.5 but would like to be on a newer version of the database 8.1.8 and eventually 8.2.X.

 

Both databases are UTF-8 encoding and running on REDHAT EL 4.0.  Both databases were created from a pg_dump that came out of a 7.4.5 version of Postgresql with SQL_ASCII encoding.  I don’t think the encoding should matter but included it for your review.

 

Re: Unexplained case insensitive results

From
"Lloyd Mason"
Date:
I have also tried the query using the same encoding with both the 8.1.5 and
8.1.8 versions and the query is still coming back with different results.
The 8.1.5 shows all records that include upper and lower case while the
8.1.8 shows only the lower case.

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Monday, April 02, 2007 12:18 PM
To: Lloyd Mason
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Unexplained case insensitive results

"Lloyd Mason" <LloydM@pbsinet.com> writes:
> There appears to be a difference in the results from the following SQL
> statement when run on an 8.1.5 version versus a 8.1.8 version:

I imagine you initdb'd the two installations with different locale
settings.  Check "show lc_collate".

            regards, tom lane



Re: Unexplained case insensitive results

From
Peter Eisentraut
Date:
Lloyd Mason wrote:
> I have also tried the query using the same encoding with both the
> 8.1.5 and 8.1.8 versions and the query is still coming back with
> different results.

He said locale, not encoding.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/