Aggregate binary AND
Aggregate binary AND
От:
"James Orr" <james@lrgmail.com>
Дата:
Hi, Is there an aggregate binary AND function in postgres? If not, is there a way to write your own aggregate functions? Examples? - James
Re: Aggregate binary AND
От:
Philip Hallstrom <philip@adhesivemedia.com>
Дата:
This worked for us in 7.something (don't need it anymore, but it should still work). You'll want to create one for INT8, INT2, etc.. if you are going to use those as well... CREATE AGGREGATE aggr_bitand ( BASETYPE = INT4, SFUNC1 = int4and, STYPE1 = INT4); On Thu, 1 Nov 2001, James Orr wrote: > Hi, > > Is there an aggregate binary AND function in postgres? If not, is there a > way to write your own aggregate functions? Examples? > > - James > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html >
Re: Aggregate binary AND
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"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