X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id 526AC11F60BD for ; Fri, 21 Apr 2006 11:26:26 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: -2.385 X-Spam-Level: X-Spam-Status: No, score=-2.385 required=5 tests=[AWL=0.216, BAYES_00=-2.599, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id stPvbxBYdR9i for ; Fri, 21 Apr 2006 11:26:24 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A163311F60A4 for ; Fri, 21 Apr 2006 11:26:21 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k3LEQG3c009497; Fri, 21 Apr 2006 10:26:16 -0400 (EDT) To: Jan Dittmer cc: jim@contactbda.com, pgsql-performance@postgresql.org Subject: Re: Better way to write aggregates? In-reply-to: <4448D195.4020801@l4x.org> References: <444899B6.6090001@l4x.org> <20060421122617.M81850@contactbda.com> <4448D195.4020801@l4x.org> Comments: In-reply-to Jan Dittmer message dated "Fri, 21 Apr 2006 14:35:33 +0200" Date: Fri, 21 Apr 2006 10:26:16 -0400 Message-ID: <9496.1145629576@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200604/503 X-Sequence-Number: 18587 Jan Dittmer writes: > It would help if booleans could be casted to integer 1/0 :-) As of 8.1 there is such a cast in the system: regression=# select 't'::bool::int; int4 ------ 1 (1 row) In earlier releases you can make your own. As for the original question, though: have you looked at the crosstab functions in contrib/tablefunc? regards, tom lane