empty column name in error message

Started by Amit Langoteover 6 years ago4 messageshackers
Jump to latest
#1Amit Langote
Langote_Amit_f8@lab.ntt.co.jp

Hi,

I wonder if it's worthwhile to fix the following not-so-friendly error message:

create index on foo ((row(a)));
ERROR: column "" has pseudo-type record

For example, the attached patch makes it this:

create index on foo ((row(a)));
ERROR: column "row" has pseudo-type record

Note that "row" as column name has been automatically chosen by the caller.

Thanks,
Amit

Attachments:

ConstructTupleDescriptor-set-attname-earlier.patchapplication/octet-stream; name=ConstructTupleDescriptor-set-attname-earlier.patchDownload+8-9
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Amit Langote (#1)
Re: empty column name in error message

Amit Langote <amitlangote09@gmail.com> writes:

I wonder if it's worthwhile to fix the following not-so-friendly error message:

create index on foo ((row(a)));
ERROR: column "" has pseudo-type record

Ugh. That used to work more nicely:

regression=# create index fooi on foo ((row(a)));
ERROR: column "pg_expression_1" has pseudo-type record

But that was back in 8.4 :-( ... 9.0 and up behave as you show.
I'm guessing we broke it when we rearranged the rules for naming
index expression columns.

For example, the attached patch makes it this:

create index on foo ((row(a)));
ERROR: column "row" has pseudo-type record

Haven't read the patch in any detail yet, but that seems like
an improvement. And I guess we need a test case, or we'll
break it again :-(

regards, tom lane

#3Amit Langote
Langote_Amit_f8@lab.ntt.co.jp
In reply to: Tom Lane (#2)
Re: empty column name in error message

On Wed, Dec 18, 2019 at 1:21 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Haven't read the patch in any detail yet, but that seems like
an improvement. And I guess we need a test case, or we'll
break it again :-(

Thanks for adding the test case.

Regards,
Amit

#4Michael Paquier
michael@paquier.xyz
In reply to: Amit Langote (#3)
Re: empty column name in error message

On Wed, Dec 18, 2019 at 11:23:17AM +0900, Amit Langote wrote:

Thanks for adding the test case.

For the archives: this has been applied as of 2acab05.
--
Michael