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: Reject attempts to alter composite types used in indexes.
Date: Mon, 27 Mar 2023 19:04:29 +0000
Message-ID: <E1pgs8q-0001cW-LN@gemulon.postgresql.org> (raw)

Reject attempts to alter composite types used in indexes.

find_composite_type_dependencies() ignored indexes, which is a poor
decision because an expression index could have a stored column of
a composite (or other container) type even when the underlying table
does not.  Teach it to detect such cases and error out.  We have to
work a bit harder than for other relations because the pg_depend entry
won't identify the specific index column of concern, but it's not much
new code.

This does not address bug #17872's original complaint that dropping
a column in such a type might lead to violations of the uniqueness
property that a unique index is supposed to ensure.  That seems of
much less concern to me because it won't lead to crashes.

Per bug #17872 from Alexander Lakhin.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/17872-d0fbb799dc3fd85d@postgresql.org

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/78838bc3d43d3557f1027b95b1961b943d8c0980

Modified Files
--------------
src/backend/commands/tablecmds.c          | 57 +++++++++++++++++++++++++++----
src/test/regress/expected/alter_table.out | 10 +++++-
src/test/regress/sql/alter_table.sql      | 11 +++++-
3 files changed, 70 insertions(+), 8 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1pgs8q-0001cW-LN@gemulon.postgresql.org>
Permalink:  ../E1pgs8q-0001cW-LN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pgs8q-0001cW-LN@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: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Reject attempts to alter composite types used in indexes.
  In-Reply-To: <E1pgs8q-0001cW-LN@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