Re: Function array_agg(array) - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: Function array_agg(array)
Date
Msg-id CAFj8pRB88E0M12YCk5Xtv1Fkqqdsb8mQRPU+8nbgN95C14F0zA@mail.gmail.com
Whole thread Raw
In response to Re: Function array_agg(array)  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Function array_agg(array)
List pgsql-hackers


2014-10-24 13:58 GMT+02:00 Pavel Stehule <pavel.stehule@gmail.com>:


2014-10-24 11:43 GMT+02:00 Ali Akbar <the.apaan@gmail.com>:

2014-10-24 16:26 GMT+07:00 Pavel Stehule <pavel.stehule@gmail.com>:
Hi

some in last patch is wrong, I cannot to compile it:

arrayfuncs.c: In function ‘accumArrayResult’:
arrayfuncs.c:4603:9: error: ‘ArrayBuildState’ has no member named ‘alen’
   astate->alen = 64;  /* arbitrary starting array size */
         ^
arrayfuncs.c:4604:9: error: ‘ArrayBuildState’ has no member named ‘dvalues’
   astate->dvalues = (Datum *) palloc(astate->alen * sizeof(Datum));
         ^
arrayfuncs.c:4604:44: error: ‘ArrayBuildState’ has no member named ‘alen’
   astate->dvalues = (Datum *) palloc(astate->alen * sizeof(Datum));
                                            ^
arrayfuncs.c:4605:9: error: ‘ArrayBuildState’ has no member named ‘dnulls’
   astate->dnulls = (bool *) palloc(astate->alen * sizeof(bool));
         ^
arrayfuncs.c:4605:42: error: ‘ArrayBuildState’ has no member named ‘alen’
   astate->dnulls = (bool *) palloc(astate->alen * sizeof(bool));
                                          ^
arrayfuncs.c:4606:9: error: ‘ArrayBuildState’ has no member named ‘nelems’
   astate->nelems = 0;
         ^
arrayfuncs.c:4618:13: error: ‘ArrayBuildState’ has no member named ‘nelems’
   if (astate->nelems >= astate->alen)
             ^
arrayfuncs.c:4618:31: error: ‘ArrayBuildState’ has no member named ‘alen’
   if (astate->nelems >= astate->alen)
                               ^
arrayfuncs.c:4620:10: error: ‘ArrayBuildState’ has no member named ‘alen’
    astate->alen *= 2;

Sorry,  correct patch attached.

This patch is in patience format (git --patience ..). In previous patches, i use context format (git --patience ... | filterdiff --format=context), but it turns out that some modification is lost.

last version is compileable, but some is still broken

postgres=# select array_agg(array[i, i+1, i-1])
            from generate_series(1,2) a(i);
ERROR:  could not find array type for data type integer[]

I am sorry, it works - I had a problem with broken database

I fixed small issue in regress tests and I enhanced tests for varlena types and null values.

Regards

Pavel
 

but array(subselect) works

postgres=# select array(select a from xx);
       array      
-------------------
 {{1,2,3},{1,2,3}}
(1 row)

Regards

Pavel

 

--
Ali Akbar


Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: BUG: *FF WALs under 9.2 (WAS: .ready files appearing on slaves)
Next
From: Heikki Linnakangas
Date:
Subject: Re: btree_gin and ranges