pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: James Orr <james@lrgmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Aggregate binary AND
Date: Thu, 01 Nov 2001 14:01:19 -0500
Message-ID: <23007.1004641279@sss.pgh.pa.us> (raw)
In-Reply-To: <00c901c162f8$f7df42e0$1600000a@lrg.office>
References: <00c901c162f8$f7df42e0$1600000a@lrg.office>

"James Orr" <james@lrgmail.com> 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



view thread (3+ messages)

Message-ID: <23007.1004641279@sss.pgh.pa.us>
Permalink:  ../23007.1004641279@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23007.1004641279@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, james@lrgmail.com
  Subject: Re: Aggregate binary AND
  In-Reply-To: <23007.1004641279@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox