pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Split array_push into separate array_append and array_prepend fu
Date: Thu, 19 Feb 2015 01:53:41 +0000
Message-ID: <E1YOGJB-0003E3-8f@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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(-)


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


Message-ID: <E1YOGJB-0003E3-8f@gemulon.postgresql.org>
Permalink:  ../E1YOGJB-0003E3-8f@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1YOGJB-0003E3-8f@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Split array_push into separate array_append and array_prepend fu
  In-Reply-To: <E1YOGJB-0003E3-8f@gemulon.postgresql.org>
  References: <E1YOGJB-0003E3-8f@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox