mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
The added aggregates are:
(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. Also add 'every' aggregate. (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. 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. Fabien COELHO
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/bool.c,v 1.32 2004/05/07 00:24:58 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/bool.c,v 1.33 2004/05/26 15:25:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -248,3 +248,23 @@ isnotfalse(PG_FUNCTION_ARGS)
|
||||
|
||||
PG_RETURN_BOOL(b);
|
||||
}
|
||||
|
||||
/*
|
||||
* boolean-and and boolean-or aggregates.
|
||||
*/
|
||||
|
||||
/* function for standard EVERY aggregate implementation conforming to SQL 2003.
|
||||
* must be strict. It is also named bool_and for homogeneity.
|
||||
*/
|
||||
Datum booland_statefunc(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_BOOL(PG_GETARG_BOOL(0) && PG_GETARG_BOOL(1));
|
||||
}
|
||||
|
||||
/* function for standard ANY/SOME aggregate conforming to SQL 2003.
|
||||
* must be strict. The name of the aggregate is bool_or. See the doc.
|
||||
*/
|
||||
Datum boolor_statefunc(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_BOOL(PG_GETARG_BOOL(0) || PG_GETARG_BOOL(1));
|
||||
}
|
||||
|
Reference in New Issue
Block a user