Received: from sss.pgh.pa.us (sss-backup.pgh.pa.us [216.151.103.158]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fA1J1OP42409 for ; Thu, 1 Nov 2001 14:01:24 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id fA1J1Kc23010; Thu, 1 Nov 2001 14:01:20 -0500 (EST) To: "James Orr" cc: pgsql-sql@postgresql.org Subject: Re: Aggregate binary AND In-reply-to: <00c901c162f8$f7df42e0$1600000a@lrg.office> References: <00c901c162f8$f7df42e0$1600000a@lrg.office> Comments: In-reply-to "James Orr" message dated "Thu, 01 Nov 2001 12:16:38 -0500" Date: Thu, 01 Nov 2001 14:01:19 -0500 Message-ID: <23007.1004641279@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200111/22 X-Sequence-Number: 5408 "James Orr" writes: > Is there an aggregate binary AND function in postgres? If not, is there a > way to write your own aggregate functions? Examples? The aggregate would be trivial given an underlying two-argument AND function to build it from: regression=# create aggregate booland ( basetype = bool, regression(# sfunc = booland, stype = bool, regression(# initcond = 'true' ); ERROR: AggregateCreate: function 'booland(bool, bool)' does not exist Unfortunately, it seems no one has bothered to create a functional form of AND (the keyword-AND operator isn't a function). I'll leave that part as an exercise for the student ... regards, tom lane