"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