Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id A86B82E02D0 for ; Thu, 13 Dec 2007 19:10:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 62129-08 for ; Thu, 13 Dec 2007 19:10:31 -0400 (AST) Received: from panda.hostingbay.net (panda.hostingbay.net [74.86.150.75]) by postgresql.org (Postfix) with ESMTP id 408AC2E0242 for ; Thu, 13 Dec 2007 19:10:41 -0400 (AST) Received: from [220.237.186.188] (helo=[192.168.0.199]) by panda.hostingbay.net with esmtpa (Exim 4.68) (envelope-from ) id 1J2xCY-0002en-5E for pgsql-sql@postgresql.org; Fri, 14 Dec 2007 10:10:46 +1100 Message-ID: <4761BBA7.7030800@eclinic.com.au> Date: Fri, 14 Dec 2007 10:09:27 +1100 From: Gavin Baumanis Organization: PalCare Pty. Ltd. User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: SELECT MAX returns wrong value Content-Type: multipart/mixed; boundary="------------070106020308080607040308" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - panda.hostingbay.net X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - eclinic.com.au X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200712/83 X-Sequence-Number: 29775 This is a multi-part message in MIME format. --------------070106020308080607040308 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Everyone, Sorry if I am missing something obvious but I think I have found a bug. If I perform the following SQL SELECT MAX(column) FROM table WHERE expression and there is no match, Postgres returns a record count of 1. There is no value in max, it is NULL. Thus trying to perform some "other" tasks based on if a record was returned or not is proving a little difficult in this instance. We are using 8.1.9 on Debian. Thanks for any help you might be able to offer. -- If I can ever be of any further assistance, please contact me. Gavin 'Beau' Baumanis eClinic Pty Ltd ABN 80 092 450 274 657 Nicholson Street Carlton North Victoria 3054 Australia P: +61 3 9381 4567 F: +61 3 9381 4657 M: +61 438 545 586 E: beau@eclinic.com.au W: http://www.eclinic.com.au --------------070106020308080607040308 Content-Type: text/x-vcard; charset=utf-8; name="gavinb.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gavinb.vcf" begin:vcard fn:Beau n:Baumanis;Gavin org:PalCare Pty. Ltd. adr:;;657 Nicholson Street;Carlton North;Melbourne;3054;Australia email;internet:beau@eclinic.com.au title:Application Developer tel;work:+61-3 9381-4567 tel;cell:+61-438-545-586 note;quoted-printable:Certified Novell Engineer (CNE)=0D=0A= Microsoft Certificed Systems Engineer (MCSE)=0D=0A= Post Graduate Certificate in IT=0D=0A= Certificate III Electronics Technician x-mozilla-html:TRUE url:http://www.palcare.com.au version:2.1 end:vcard --------------070106020308080607040308--