Skip site navigation (1) Skip section navigation (2)

"ORDER BY" issue - is this a bug?

From: Max Pyziur <pyz(at)panix(dot)com>
To: pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org, pgsql-bugs(at)hub(dot)org
Subject: "ORDER BY" issue - is this a bug?
Date: 2000-09-10 18:19:08
Message-ID: 39BBD09C.C8F6B3F8@panix.com (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-bugspgsql-sql
Greetings, 

I've been using postgresql for some time and currently am using it in three
different environments (specific details below) w/ the first two being 6.5.x
releases and the third  7.0.2-2:

I've come across what I consider an odd sorting anomaly in 7.0.2-2 where running
the following query:
select headline from headlines where headline like 'Alb%' order by 1 ;

The results in the 7.0.2-2 install come back case-insensitive and oblivious to
punctuation.  This seems to me to be a bug; case-insensitive ordering can be
achieved with the use of UPPER() or LOWER() functions, otherwise why have the
functions.  Also, I've created three test databases on the 7.0.2-2 system each
with a different specified encoding  - 
         List of databases
  Database  |  Owner   | Encoding  
------------+----------+-----------
 headlines  | deckard  | WIN
 headlines2 | deckard  | SQL_ASCII
 headlines3 | deckard  | LATIN1

to see if the results are different.  Each of the encodings produces the same
anomalous results.

Any help in this regard as well as resolving it would be appreciated.  Details
of systems and schema are appended below.

-- 
Max Pyziur                                     BRAMA - Gateway Ukraine
pyz(at)brama(dot)com                                  http://www.brama.com/


The Details:

On the first two systems the results are as follows:
headline                                                     
-------------------------------------------------------------
Albright Arrives in Ukraine to Boost Reforms                 
Albright Calls on Ukraine to Announce Chernobyl Closure      
Albright Calls on Ukraine to Speed up Military Reforms       
Albright Hopeful on Chernobyl Cover                          
Albright Meets Ukraine Officials                             
Albright Reschedules Ukraine Visit                           
Albright Throws Weight Behind Ukraine's Kuchma               
Albright To Hold Talks in Ukraine                            
Albright plans to show support for reform in visit to Ukraine
Albright plans to show support for reform in visit to Ukraine
Albright rushes to kyiv ahead of putin                       
Albright says U.S. still backs Kuchma                        
Albright to perform balancing act in Central Asia            
Albright, in Kiev, Hails Russian START-2 Vote                
(14 rows)
#####################################################################

On the 7.0.2-2 system it is:
                           headline                            
---------------------------------------------------------------
 Albright Arrives in Ukraine to Boost Reforms 
 Albright Calls on Ukraine to Announce Chernobyl Closure
 Albright Calls on Ukraine to Speed up Military Reforms
 Albright Hopeful on Chernobyl Cover 
 Albright, in Kiev, Hails Russian START-2 Vote
 Albright Meets Ukraine Officials 
 Albright plans to show support for reform in visit to Ukraine
 Albright plans to show support for reform in visit to Ukraine
 Albright Reschedules Ukraine Visit 
 Albright rushes to kyiv ahead of putin
 Albright says U.S. still backs Kuchma
 Albright Throws Weight Behind Ukraine's Kuchma 
 Albright To Hold Talks in Ukraine 
 Albright to perform balancing act in Central Asia
(14 rows)
#####################################################################



1 - Production - Solaris 2.6 running Postgresql 6.5.2 on a small Sparc 2
compiled from source
2 - Development - RH5.2 Linux 2.0.36 running Postgresql 6.5.3 installed from
rpms
3 - Development - RH6.2 Linux 2.2.14-5.0smp running Postgresql 7.0.2-2 installed
from stock rpms

Database table schema:
headlines=> \d headlines
Table    = headlines
+----------------------------------+----------------------------------+-------+
|              Field               |              Type                | Length|
+----------------------------------+----------------------------------+-------+
| headline_id                      | int4 not null default nextval (  |     4 |
| headline                         | text                             |   var |
| url                              | text                             |   var |
| postdate                         | date                             |     4 |
| source                           | text                             |   var |
| flags                            | text                             |   var |
| posttime                         | timestamp                        |     4 |
+----------------------------------+----------------------------------+-------+
Indices:  headlines_headline_id_key
          hl_pdate
          hl_s_pd
          hl_srce



-- 
Max Pyziur                                     BRAMA - Gateway Ukraine
pyz(at)brama(dot)com                                  http://www.brama.com/

Responses

pgsql-admin by date

Next:From: Tom LaneDate: 2000-09-11 00:35:18
Subject: Re: [BUGS] "ORDER BY" issue - is this a bug?
Previous:From: Lindell AldermanDate: 2000-09-08 23:13:20
Subject: backup/restore

pgsql-bugs by date

Next:From: Tom LaneDate: 2000-09-11 00:35:18
Subject: Re: [BUGS] "ORDER BY" issue - is this a bug?
Previous:From: Stephan SzaboDate: 2000-09-09 16:43:31
Subject: Re: Backend crash trying to delete rows

pgsql-sql by date

Next:From: Tom LaneDate: 2000-09-11 00:35:18
Subject: Re: [BUGS] "ORDER BY" issue - is this a bug?
Previous:From: Tom LaneDate: 2000-09-09 21:03:36
Subject: Re: Creating an aggregate function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group