Thread: new aggregate functions v2
Dear patchers, please find attached my second patch submission for adding new aggregate functions: (1) boolean-and and boolean-or aggregates named bool_and and bool_or. they should correspond to standard sql every and some/any aggregates. they do not have the right name as there is a problem with the standard and the parser for some/any. Tom also think that the standard name is misleading because NULL are ignored. (2) bitwise integer aggregates named bit_and and bit_or for int2, int4, int8 and bit types. They are not standard, but I find them useful. I needed them once, and I'm not the first one to look for them. The patches adds: - 2 new very short strict functions for boolean aggregates in src/backed/utils/adt/bool.c, src/include/utils/builtins.h and src/include/catalog/pg_proc.h - the new aggregates declared in src/include/catalog/pg_proc.h and src/include/catalog/pg_aggregate.h - some documentation and validation about these new aggregates. It also updates the catalog version. It validates for me. Have a nice day, -- Fabien Coelho - coelho@cri.ensmp.fr
Attachment
On Sunday 02 May 2004 11:22, Fabien COELHO wrote: > Dear patchers, > > please find attached my second patch submission for adding > new aggregate functions: > > (1) boolean-and and boolean-or aggregates named bool_and and bool_or. > they should correspond to standard sql every and some/any aggregates. > they do not have the right name as there is a problem with > the standard and the parser for some/any. Tom also think that > the standard name is misleading because NULL are ignored. > > (2) bitwise integer aggregates named bit_and and bit_or for > int2, int4, int8 and bit types. They are not standard, but I find > them useful. I needed them once, and I'm not the first one to look for > them. > > > The patches adds: > > - 2 new very short strict functions for boolean aggregates in > src/backed/utils/adt/bool.c, > src/include/utils/builtins.h and src/include/catalog/pg_proc.h > > - the new aggregates declared in src/include/catalog/pg_proc.h and > src/include/catalog/pg_aggregate.h > > - some documentation and validation about these new aggregates. > > It also updates the catalog version. It validates for me. > > Have a nice day, Just a minor nibble, but could you add something to the documentation entries that these are postgresql implementation of the sql any/some/every aggregate functions. right now we have whole pages devoted to any/some for subqueries and arrays, I'd like to give people looking for the sql spec aggregate functions at least a chance of finding these. Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
Dear Robert, > > (1) boolean-and and boolean-or aggregates named bool_and and bool_or. > > they should correspond to standard sql every and some/any aggregates. > > Just a minor nibble, but could you add something to the documentation > entries that these are postgresql implementation of the sql > any/some/every aggregate functions. Yep, that can be done. > right now we have whole pages devoted to any/some for subqueries and > arrays, I'd like to give people looking for the sql spec aggregate > functions at least a chance of finding these. Do you mean one or both of the following? - add a note in the aggregate doc that they correspond to EVERY and SOME/ANY standard aggregates. - add a note somewhere else, maybe in the doc about arrays or subqueries, that there are also aggregates with a non standard name. if so, where precisely should it be put? Thanks in advance, -- Fabien Coelho - coelho@cri.ensmp.fr
On Wed, 2004-05-05 at 02:59, Fabien COELHO wrote: > > Dear Robert, > > > > (1) boolean-and and boolean-or aggregates named bool_and and bool_or. > > > they should correspond to standard sql every and some/any aggregates. > > > > Just a minor nibble, but could you add something to the documentation > > entries that these are postgresql implementation of the sql > > any/some/every aggregate functions. > > Yep, that can be done. > > > right now we have whole pages devoted to any/some for subqueries and > > arrays, I'd like to give people looking for the sql spec aggregate > > functions at least a chance of finding these. > > Do you mean one or both of the following? > > - add a note in the aggregate doc that they correspond to > EVERY and SOME/ANY standard aggregates. > I meant this one. > - add a note somewhere else, maybe in the doc about arrays or subqueries, > that there are also aggregates with a non standard name. > if so, where precisely should it be put? > It seems that might be a little intrusive wouldn't it? If we can make sure the aggregate functions page gets picked up in the index entry for any/some I think that would be appropriate. Thanks for your efforts. Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL