X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C1A89D1BB7B for ; Mon, 5 Apr 2004 21:55:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 03025-01 for ; Mon, 5 Apr 2004 18:55:45 -0300 (ADT) Received: from mail1.elevating.com (wsip-68-99-77-237.tu.ok.cox.net [68.99.77.237]) by svr1.postgresql.org (Postfix) with ESMTP id A2579D1B97B for ; Mon, 5 Apr 2004 18:55:12 -0300 (ADT) Received: from bretsony.hugheshome.org (bretsony.brets.elevating.com [10.23.0.50]) (authenticated) by mail1.elevating.com (8.11.6/8.11.6) with ESMTP id i35LthF02027 for ; Mon, 5 Apr 2004 16:55:43 -0500 Subject: group by not returning sorted rows From: Bret Hughes To: pgsql-sql@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-9.7x.1) Date: 05 Apr 2004 16:55:42 -0500 Message-Id: <1081202143.18380.117.camel@bretsony> Mime-Version: 1.0 X-Elevating-MailScanner: Found to be clean X-Elevating-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.5, required 5, BAYES_00 -1.50) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/24 X-Sequence-Number: 17399 I have a query: select cities.name as city, buildings.name as building, pagename, log_date , sum(exhibition_count) as tot from logrecords join cities on (logrecords.city=cities.num) join buildings on (logrecords.building=buildings.num) where advertiser = 'Nielsens' and log_date >= '01/01/2004' and log_date <= '01/31/2004' group by cities.name, buildings.name,pagename,log_date ; I have migrated a database from a redhat 7.3 box running [bhughes@compaq3 reports]$ rpm -q postgresql postgresql-7.2.3-5.73 To a redhat 9 box running : [bhughes@compaq2 reports]$ rpm -q postgresql postgresql-7.4.2-1PGDG and the rows resulting from the query are no longer sorted by log date. Is this a change since 7.2x? I can achieve the results I need by adding an order by clause identical to the group by but this seems counter intuitive since the rows have to be ordered anyway. Any tips appreciated. Bret