pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix unexpected error messages for various flavors of ALTER TABLE
Date: Wed, 14 Jul 2021 08:16:24 +0000
Message-ID: <E1m3a48-0002gW-0a@gemulon.postgresql.org> (raw)

Fix unexpected error messages for various flavors of ALTER TABLE

Some commands of ALTER TABLE could fail with the following error:
ERROR:  "tab" is of the wrong type

This error is unexpected, as all the code paths leading to
ATWrongRelkindError() should use a supported set of relkinds to generate
correct error messages.  This commit closes the gap with such mistakes,
by adding all the missing relkind combinations.  Tests are added to
check all the problems found.  Note that some combinations are not used,
but these are left around as it could have an impact on applications
relying on this code.

2ed532e has done a much larger refactoring on HEAD to make such error
messages easier to manage in the long-term, so nothing is needed there.

Author: Kyotaro Horiguchi
Reviewed-by: Peter Eisentraut, Ahsan Hadi, Michael Paquier
Discussion: https://postgr.es/m/20210216.181415.368926598204753659.horikyota.ntt@gmail.com
Backpatch-through: 11

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5226243459f11e0029c803674aabfb3bc25192f7

Modified Files
--------------
src/backend/commands/tablecmds.c           |  9 +++++++++
src/test/regress/expected/alter_table.out  | 10 ++++++++++
src/test/regress/expected/foreign_data.out |  2 ++
src/test/regress/sql/alter_table.sql       |  9 +++++++++
src/test/regress/sql/foreign_data.sql      |  1 +
5 files changed, 31 insertions(+)



view thread (4+ messages)  latest in thread

Message-ID: <E1m3a48-0002gW-0a@gemulon.postgresql.org>
Permalink:  ../E1m3a48-0002gW-0a@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1m3a48-0002gW-0a@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: michael@paquier.xyz
  Subject: Re: pgsql: Fix unexpected error messages for various flavors of ALTER TABLE
  In-Reply-To: <E1m3a48-0002gW-0a@gemulon.postgresql.org>
  References: <E1m3a48-0002gW-0a@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