From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | array_push is just stupid ... |
Date: | 2015-02-19 00:27:58 |
Message-ID: | 21591.1424305678@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2015-02-19 00:35:14 | INSERT ... ON CONFLICT UPDATE and logical decoding |
Previous Message | Kevin Grittner | 2015-02-19 00:03:02 | Re: Allow "snapshot too old" error, to prevent bloat |