Search Postgresql Archives

Array operator "sum array values"

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

 



Hi,

is there a syntax that sums the values of an array?

That is, having an array like

{1,3,8},{5,6,7}

something like 

select arr[1:2][2:3]

gives

{1,3},{6,7}


; what I'd like is:

select arr[1$2][2$3]

gives:

17 (that is, 1+3 + 6+7)

If there is no such operator, would it be complicated adding it to postgres? 
I mean: is the "[:]" operator an internal thing (the parser "knows" about it) or is it just like any other operators that can be added ?









      ___________________________________ 
Scopri il Blog di Yahoo! Mail: trucchi, novità, consigli... e la tua opinione!
http://www.ymailblogit.com/blog/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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 Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux