pgsql: Include typmod when complaining about inherited column type mism

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Include typmod when complaining about inherited column type mism
Date: 2015-12-26 18:41:59
Message-ID: E1aCtmx-00069D-SK@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Include typmod when complaining about inherited column type mismatches.

MergeAttributes() rejects cases where columns to be merged have the same
type but different typmod, which is correct; but the error message it
printed didn't show either typmod, which is unhelpful. Changing this
requires using format_type_with_typemod() in place of TypeNameToString(),
which will have some minor side effects on the way some type names are
printed, but on balance this is an improvement: the old code sometimes
printed one type according to one set of rules and the other type according
to the other set, which could be confusing in its own way.

Oddly, there were no regression test cases covering any of this behavior,
so add some.

Complaint and fix by Amit Langote

Branch
------
master

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

Modified Files
--------------
src/backend/commands/tablecmds.c | 12 ++++++++----
src/test/regress/expected/alter_table.out | 21 +++++++++++++++++++++
src/test/regress/sql/alter_table.sql | 11 +++++++++++
3 files changed, 40 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2015-12-27 16:04:45 pgsql: Add forgotten CHECK_FOR_INTERRUPT calls in pgcrypto's crypt()
Previous Message Tom Lane 2015-12-26 17:56:15 pgsql: Fix brin_summarize_new_values() to check index type and ownershi