Search Postgresql Archives

Re: Properly handling aggregate in nested function call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15/12/2021, at 11:51 AM, Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
You should
probably palloc temp arrays right here and then use construct_md_array
directly instead of dealing with an ArrayBuildState.

OK, I gave that a go [1] this time in a vec_agg_sum() aggregate, that operates much the same as the vec_agg_mean() one and is behaving in the same way. For example this shows the correct values:

SELECT vec_agg_sum(nums) FROM measurements;
NOTICE:  sum 0 = 4.92
NOTICE:  sum 1 = 5.91
NOTICE:  sum 2 = 14.80
    vec_agg_sum    
-------------------
 {4.92,5.91,14.80}
(1 row)


But adding unnest() goes back to seemingly memory address values:

SELECT unnest(vec_agg_sum(nums)) FROM measurements;
NOTICE:  sum 0 = 4.92
NOTICE:  sum 1 = 5.91
NOTICE:  sum 2 = 14.80
     unnest     
----------------
 94069010663032
 94069010663044
 94069010663056
(3 rows)

Any other ideas I could look into?

— m@



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux