pgsql: Fix error reporting for index expressions of prohibited types.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix error reporting for index expressions of prohibited types.
Date: 2019-12-17 22:44:56
Message-ID: E1ihLaK-0007Ev-AL@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix error reporting for index expressions of prohibited types.

If CheckAttributeType() threw an error about the datatype of an
index expression column, it would report an empty column name,
which is pretty unhelpful and certainly not the intended behavior.
I (tgl) evidently broke this in commit cfc5008a5, by not noticing
that the column's attname was used above where I'd placed the
assignment of it.

In HEAD and v12, this is trivially fixable by moving up the
assignment of attname. Before v12 the code is a bit more messy;
to avoid doing substantial refactoring, I took the lazy way out
and just put in two copies of the assignment code.

Report and patch by Amit Langote. Back-patch to all supported
branches.

Discussion: https://postgr.es/m/CA+HiwqFA+BGyBFimjiYXXMa2Hc3fcL0+OJOyzUNjhU4NCa_XXw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2acab054b3ff8e46707727980ce3fa1a1897381f

Modified Files
--------------
src/backend/catalog/index.c | 17 +++++++-------
src/test/regress/expected/create_index.out | 37 ++++++++++++++++++++++++++++++
src/test/regress/sql/create_index.sql | 12 ++++++++++
3 files changed, 57 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2019-12-18 01:12:45 pgsql: Remove shadow variables linked to RedoRecPtr in xlog.c
Previous Message Robert Haas 2019-12-17 20:59:34 Re: pgsql: Code cleanup for toast_fetch_datum and toast_fetch_datum_slice.