pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@postgresql.org
Subject: pgsql: Retain comments on indexes and constraints at ALTER TABLE ... TY
Date: Tue, 14 Jul 2015 08:43:50 +0000
Message-ID: <E1ZEvoc-0002RV-Vh@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Retain comments on indexes and constraints at ALTER TABLE ... TYPE ...

When a column's datatype is changed, ATExecAlterColumnType() rebuilds all
the affected indexes and constraints, and the comments from the old
indexes/constraints were not carried over.

To fix, create a synthetic COMMENT ON command in the work queue, to re-add
any comments on constraints. For indexes, there's a comment field in
IndexStmt that is used.

This fixes bug #13126, reported by Kirill Simonov. Original patch by
Michael Paquier, reviewed by Petr Jelinek and me. This bug is present in
all versions, but only backpatch to 9.5. Given how minor the issue is, it
doesn't seem worth the work and risk to backpatch further than that.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/e42375fc8124e99c33fa330c53c2b4b502fa0baf

Modified Files
--------------
src/backend/commands/tablecmds.c          |   65 ++++++++++++++++++++++++++++-
src/include/nodes/parsenodes.h            |    1 +
src/test/regress/expected/alter_table.out |   63 ++++++++++++++++++++++++++++
src/test/regress/sql/alter_table.sql      |   36 ++++++++++++++++
4 files changed, 163 insertions(+), 2 deletions(-)


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


view thread (13+ messages)  latest in thread

Message-ID: <E1ZEvoc-0002RV-Vh@gemulon.postgresql.org>
Permalink:  ../E1ZEvoc-0002RV-Vh@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ZEvoc-0002RV-Vh@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi
  Subject: Re: pgsql: Retain comments on indexes and constraints at ALTER TABLE ... TY
  In-Reply-To: <E1ZEvoc-0002RV-Vh@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