dbTalk Databases Forums  

Re: new aggregate functions v3

comp.databases.postgresql.patches comp.databases.postgresql.patches


Discuss Re: new aggregate functions v3 in the comp.databases.postgresql.patches forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: new aggregate functions v3 - 05-18-2004 , 07:40 PM







[ Use newest version.]

Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Fabien COELHO wrote:
Quote:
Dear patchers,

please find attached my third patch submission for adding new aggregate
functions. This new version adds a note and some indexes in the
documentation about sql standard names for bool_and and bool_or, as
suggested by Robert Treat. It also fixes conflicts created by the removal
of shameful aclitem accessors.

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.

(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.


It also updates the catalog version. It validates for me.

Have a nice day,

--
Fabien Coelho - coelho (AT) cri (DOT) ensmp.fr
Content-Description:

[ Attachment, skipping... ]

Quote:
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
--
Bruce Momjian | http://candle.pha.pa.us
pgman (AT) candle (DOT) pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org



Reply With Quote
  #2  
Old   
Neil Conway
 
Posts: n/a

Default Re: new aggregate functions v3 - 05-19-2004 , 01:41 AM






Fabien COELHO wrote:
Quote:
(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.
As I understand it, there's an ambiguity issue with SOME/ANY, but not
with EVERY. If so, can we implement EVERY per-spec at least? It's okay
if we just add EVERY as an alias for BOOL_AND for the sake of homogeneity.

A few trivial points:

Quote:
+ /* EVERY aggregate implementation conforming to SQL 2003 standard.
+ * must be strict.
+ */
This comment is misleading if we don't actually provide an
implementation of EVERY that conforms to spec. There's a similar comment
WRT to SOME/ANY.

Quote:
+ PG_FUNCTION_INFO_V1(booland_statefunc);
Not needed for builtin functions (they are assumed to be V1).

Quote:
+ /* what about every? */
+ DATA(insert OID = 2517 ( bool_and PGNSP PGUID 12 t f f f i 1 16 "16" _null_ aggregate_dummy - _null_ ));
+ DESCR("boolean-and aggregate");
+ /* what about any/some? */
Seems these questions should be removed, no?

-Neil


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Reply With Quote
  #3  
Old   
Fabien COELHO
 
Posts: n/a

Default Re: new aggregate functions v3 - 05-19-2004 , 03:14 AM




Dear Neil,

Quote:
As I understand it, there's an ambiguity issue with SOME/ANY, but not
with EVERY. If so, can we implement EVERY per-spec at least? It's okay
if we just add EVERY as an alias for BOOL_AND for the sake of homogeneity.
Ok.

Quote:
+ /* EVERY aggregate implementation conforming to SQL 2003 standard.
+ * must be strict.
+ */

This comment is misleading if we don't actually provide an
implementation of EVERY that conforms to spec. There's a similar comment
WRT to SOME/ANY.
I agree it is somehow misleading. I'll clarify.

Quote:
+ PG_FUNCTION_INFO_V1(booland_statefunc);
Not needed for builtin functions (they are assumed to be V1).
Ok, I'll drop that.

Quote:
+ /* what about every? */
+ DATA(insert OID = 2517 ( bool_and PGNSP PGUID 12 t f f f i 1 16 "16" _null_ aggregate_dummy - _null_ ));
+ DESCR("boolean-and aggregate");
+ /* what about any/some? */

Seems these questions should be removed, no?
Well, the question really means "what about naming it every", that is
you're very question above!

I'll do a fix wrt to your comments, and send a 4th version.

Thanks for your comments.

--
Fabien Coelho - coelho (AT) cri (DOT) ensmp.fr

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.