Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id AD2361F07124 for ; Thu, 26 Jan 2012 21:09:46 -0400 (AST) Received: from mail-iy0-f174.google.com ([209.85.210.174]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RqaJy-0005QX-FE for pgsql-bugs@postgresql.org; Fri, 27 Jan 2012 01:09:45 +0000 Received: by iacb35 with SMTP id b35so1418263iac.19 for ; Thu, 26 Jan 2012 17:09:29 -0800 (PST) Received: by 10.50.214.73 with SMTP id ny9mr4592009igc.1.1327626569292; Thu, 26 Jan 2012 17:09:29 -0800 (PST) Received: from ?IPv6:::1? (li224-40.members.linode.com. [173.255.214.40]) by mx.google.com with ESMTPS id py9sm2755388igc.2.2012.01.26.17.09.27 (version=SSLv3 cipher=OTHER); Thu, 26 Jan 2012 17:09:28 -0800 (PST) Subject: 8.4, 9.0 bug (doesn't exist in 9.1) related to window functions From: Jeff Davis To: pgsql-bugs@postgresql.org Content-Type: text/plain; charset="ISO-8859-1" Date: Thu, 26 Jan 2012 16:06:31 -0800 Message-ID: <1327622791.14650.8.camel@sussancws0025> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201201/184 X-Sequence-Number: 32251 In REL8_4_STABLE and REL9_0_STABLE: => select ntile(3) OVER ( ORDER BY CASE WHEN count(i) = 0 THEN NULL ELSE count(i) END asc ) from ( SELECT NULL::integer as i limit 0 ) s ; ERROR: cannot extract attribute from empty tuple slot A different error appears in 9.1.0 ("could not find pathkey item to sort"), but it's fixed sometime later in the 9.1 series. If you get rid of the CASE statement, then it still fails in 8.4 and 9.0, but it succeeds in 9.1.0 and beyond. Regards, Jeff Davis