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: Make SPI_fnumber() reject dropped columns.
Date: Tue, 08 Nov 2016 18:11:46 +0000
Message-ID: <E1c4As6-0000F7-UH@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Make SPI_fnumber() reject dropped columns.

There's basically no scenario where it's sensible for this to match
dropped columns, so put a test for dropped-ness into SPI_fnumber()
itself, and excise the test from the small number of callers that
were paying attention to the case.  (Most weren't :-(.)

In passing, normalize tests at call sites: always reject attnum <= 0
if we're disallowing system columns.  Previously there was a mixture
of "< 0" and "<= 0" tests.  This makes no practical difference since
SPI_fnumber() never returns 0, but I'm feeling pedantic today.

Also, in the places that are actually live user-facing code and not
legacy cruft, distinguish "column not found" from "can't handle
system column".

Per discussion with Jim Nasby; thi supersedes his original patch
that just changed the behavior at one call site.

Discussion: <b2de8258-c4c0-1cb8-7b97-e8538e5c975c@BlueTreble.com>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6d30fb1f75a57d80f80e27770d39d88f8aa32d28

Modified Files
--------------
contrib/spi/autoinc.c               |  2 +-
contrib/spi/insert_username.c       |  2 +-
contrib/spi/moddatetime.c           |  4 ++--
contrib/spi/refint.c                |  5 +++--
contrib/spi/timetravel.c            |  4 ++--
doc/src/sgml/spi.sgml               |  2 +-
src/backend/executor/spi.c          |  3 ++-
src/backend/utils/adt/tsvector_op.c |  1 +
src/pl/plperl/plperl.c              |  7 ++++++-
src/pl/tcl/pltcl.c                  | 11 +----------
src/test/regress/regress.c          |  9 +++++----
11 files changed, 25 insertions(+), 25 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: <E1c4As6-0000F7-UH@gemulon.postgresql.org>
Permalink:  ../E1c4As6-0000F7-UH@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1c4As6-0000F7-UH@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: Make SPI_fnumber() reject dropped columns.
  In-Reply-To: <E1c4As6-0000F7-UH@gemulon.postgresql.org>
  References: <E1c4As6-0000F7-UH@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