Skip site navigation (1) Skip section navigation (2)

Re: Aggregate "rollup"

From: mlw <pgsql(at)mohawksoft(dot)com>
To: Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Aggregate "rollup"
Date: 2003-03-06 19:59:00
Message-ID: 3E67A884.6080901@mohawksoft.com (view raw or flat)
Thread:
Lists: pgsql-hackers

Merlin Moncure wrote:

>>-----Original Message-----
>>From: mlw [mailto:pgsql(at)mohawksoft(dot)com]
>>Sent: Wednesday, March 05, 2003 3:47 PM
>>To: pgsql-hackers(at)postgresql(dot)org
>>Subject: [HACKERS] Aggregate "rollup"
>>
>>I had written a piece of code about two years ago that used the
>>aggregate feature of PostgreSQL to create an array of integers from an
>>aggregate, as:
>>
>>select int_array_aggregate( column ) from table group by column
>>
>>    
>>
>
>Do I understand correctly that this still follows the normal rules for
>grouping, so that only like values are put in the array?
>
>Example: column has values 1,1,1,2,2 spread over 5 rows.
>Your query returns two rows with row1={1,1,1} and row2 = {2,2}...is this
>correct?
>
Actually, it is more intended to put all the entries in a "one to many" 
table in a single column, as:

create table classic_one_to_many
(
    leftside    integer,
    rightside    integer
);

create table fast_lookup as select leftside, 
int_array_aggregate(rightside) from classic_one_to_many group by leftside;



In response to

pgsql-hackers by date

Next:From: Dave PageDate: 2003-03-06 20:08:46
Subject: Re: Partial index on date column
Previous:From: Adam HarnettDate: 2003-03-06 19:56:29
Subject: Unsubscribe

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group