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@lists.postgresql.org
Subject: pgsql: Disallow changing an inherited column's type if not all parents
Date: Sun, 18 Aug 2019 21:12:17 +0000
Message-ID: <E1hzSTJ-0001if-89@gemulon.postgresql.org> (raw)

Disallow changing an inherited column's type if not all parents changed.

If a table inherits from multiple unrelated parents, we must disallow
changing the type of a column inherited from multiple such parents, else
it would be out of step with the other parents.  However, it's possible
for the column to ultimately be inherited from just one common ancestor,
in which case a change starting from that ancestor should still be
allowed.  (I would not be excited about preserving that option, were
it not that we have regression test cases exercising it already ...)

It's slightly annoying that this patch looks different from the logic
with the same end goal in renameatt(), and more annoying that it
requires an extra syscache lookup to make the test.  However, the
recursion logic is quite different in the two functions, and a
back-patched bug fix is no place to be trying to unify them.

Per report from Manuel Rigger.  Back-patch to 9.5.  The bug exists in
9.4 too (and doubtless much further back); but the way the recursion
is done in 9.4 is a good bit different, so that substantial refactoring
would be needed to fix it in 9.4.  I'm disinclined to do that, or risk
introducing new bugs, for a bug that has escaped notice for this long.

Discussion: https://postgr.es/m/CA+u7OA4qogDv9rz1HAb-ADxttXYPqQdUdPY_yd4kCzywNxRQXA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4d4c66addfd4da51b0e4be456d6109bea4539fac

Modified Files
--------------
src/backend/commands/tablecmds.c      | 45 ++++++++++++++++++++++++++++++-----
src/test/regress/expected/inherit.out | 10 ++++++++
src/test/regress/sql/inherit.sql      |  9 +++++++
3 files changed, 58 insertions(+), 6 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1hzSTJ-0001if-89@gemulon.postgresql.org>
Permalink:  ../E1hzSTJ-0001if-89@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hzSTJ-0001if-89@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: Disallow changing an inherited column's type if not all parents
  In-Reply-To: <E1hzSTJ-0001if-89@gemulon.postgresql.org>
  References: <E1hzSTJ-0001if-89@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