pgsql: Split array_push into separate array_append and array_prepend fu

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Split array_push into separate array_append and array_prepend fu
Date: 2015-02-19 01:53:41
Message-ID: E1YOGJB-0003E3-8f@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Split array_push into separate array_append and array_prepend functions.

There wasn't any good reason for a single C function to implement both
these SQL functions: it saved very little code overall, and it required
significant pushups to re-determine at runtime which case applied. Redoing
it as two functions ends up with just slightly more lines of code, but it's
simpler to understand, and faster too because we need not repeat syscache
lookups on every call.

An important side benefit is that this eliminates the only case in which
different aliases of the same C function had both anyarray and anyelement
arguments at the same position, which would almost always be a mistake.
The opr_sanity regression test will now notice such mistakes since there's
no longer a valid case where it happens.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/56a79a869bedc4bf6c35853642694cc0b0594dd2

Modified Files
--------------
src/backend/utils/adt/array_userfuncs.c | 222 +++++++++++++++++-------------
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.h | 4 +-
src/include/utils/array.h | 3 +-
src/test/regress/expected/opr_sanity.out | 6 +-
5 files changed, 130 insertions(+), 107 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-02-19 03:33:46 pgsql: Update assorted TOAST-related documentation.
Previous Message Peter Eisentraut 2015-02-19 01:26:36 pgsql: Fix Perl coding error in msvc build system