Re: bitwise and/or aggregate functions?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bitwise and/or aggregate functions?
Date: 2004-04-27 17:51:26
Message-ID: 200404271751.i3RHpQk15212@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Fabien COELHO wrote:
>
> Dear hackers,
>
> still in the spirit of "it may be useful to others, as it was to me, and
> it does cost very little", and before submitting a small patch and being
> exploded because it is obviously very stupid:
>
> Would it be appropriate to contribute BIT_AND and BIT_OR aggregates
> for integer types, with some documentation and minimal validation?
> There has been a discussion recently on pgsql-general about that.
>
> 1) mysql has them... it seems to be an argument here around sometimes;-)
> it is in their proud list-of-features that it has and that postgresql
> does not have.
>
> 2) each declaration is a 4-line "CREATE AGGREGATE", the underlying
> functions being already available for & and | operators.
>
> 3) I know that one can add them if they are needed, but what
> would be the point of NOT providing such simple features, and
> having the basic user to have to learn about creating aggregate
> functions and browse a long time in the documentation for that?
>
> I needed them for some application: I'm happy I know how to add them now,
> but I would have been even happier if I had found them just available
> without having to learn about these intesting details about postgresql
> extensions.

I am confused why you would use bit on integers when there is a bit type
with an AND operator:

pg_catalog | & | bit | bit | bit | bitwise and

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexey Borzov 2004-04-27 17:52:01 Re: [HACKERS] What can we learn from MySQL?
Previous Message scott.marlowe 2004-04-27 17:51:04 Re: Usability, MySQL, Postgresql.org, gborg, contrib, etc.