While hacking around with expanded arrays, I realized that array_push() is just a horribly badly designed function. There is no reason at all for the same C function to underlie both array_append and array_prepend: the function spends significant time and effort reverse-engineering which way it was called, and there's very little logic-in-common that would justify merging the two code paths. If we split it apart into separate array_append and array_prepend functions, I think we'd actually end up with less code. And it would certainly be noticeably faster because we'd not need to be doing get_fn_expr_argtype and get_element_type (the latter of which is a syscache lookup, hence not so cheap) on *both* arguments every time through. (Admittedly, some of that could be bought back with a bit more effort on locally caching the result, but it would be better to know which input is the array a priori.)
Barring objections, I'm going to go fix this independently of the expanded-array changes. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers