* Evergreen master
* PostgreSQL 9.0.5
* Fedora 15
PostgreSQL 8.4 introduced ARRAY_AGG(), a native function that replaces our custom ARRAY_ACCUM() (for the most part a drop-in replacement, with a slight variation in that ARRAY_AGG() returns NULL while ARRAY_ACCUM returns '{}' instead).
PostgreSQL 9.0 introduced STRING_AGG(), a native function that replaces ARRAY_TO_STRING(ARRAY_AGG()) with performance that is 1-2 orders of magnitude better (at least in some basic benchmarks).
In general, native functions should be preferred to custom functions. I've pushed a branch - user/dbs/array_accum_2_array_agg @ working - that drops in ARRAY_AGG() and STRING_AGG() where appropriate. While exercising the affected functions, I found and fixed one function that had never worked. I can't claim to have tested all variations of all affected functions, but I have read the code to look for places where NULL vs. '{}' may cause issues and exercised a large percentage of the functionality with no apparent problems.
If there is interest in merging this, I can add upgrade scripts to the branch. I haven't added them yet as I don't want to have to continually update them whilst the schema evolves - merge doesn't happen to new files! Just give me a heads up. Also, this will be a good chance to try out the supersedes functionality in the upgrade scripts, as we just issued an updated asset.merge_record_assets() function and that can be superseded.
Updated the branch to replace the ARRAY_ACCUM() usage inside the new functions that were created as part of the authority NFI work with ARRAY_AGG().