Re: Doing better at HINTing an appropriate column within errorMissingColumn()

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Peter Geoghegan <pg(at)heroku(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, Josh Berkus <josh(at)agliodbs(dot)com>, Ian Barwick <ian(at)2ndquadrant(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Greg Stark <stark(at)mit(dot)edu>, Jim Nasby <jim(at)nasby(dot)net>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Subject: Re: Doing better at HINTing an appropriate column within errorMissingColumn()
Date: 2014-12-15 16:44:57
Message-ID: CA+TgmoaxiCJJhbvy3aB-dYHaL25YYsEWq1fB3K2qC=c8J1RYkQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Dec 14, 2014 at 8:24 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Tue, Dec 9, 2014 at 2:52 AM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:
>> On Mon, Dec 8, 2014 at 9:43 AM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:
>>> I think it's very possible that the wrong alias may be provided by the
>>> user, and that we should consider that when providing a hint.
>>
>> Note that the existing mechanism (the mechanism that I'm trying to
>> improve) only ever shows this error message:
>>
>> "There is a column named \"%s\" in table \"%s\", but it cannot be
>> referenced from this part of the query."
>>
>> I think it's pretty clear that this general class of user error is common.
> Moving this patch to CF 2014-12 as work is still going on, note that
> it is currently marked with Robert as reviewer and that its current
> status is "Needs review".

The status here is more like "waiting around to see if anyone else has
an opinion". The issue is what should happen when you enter qualified
name like alvaro.herrera and there is no column named anything like
herrara in the RTE named alvaro, but there is some OTHER RTE that
contains a column with a name that is only a small Levenshtein
distance away from herrera, like roberto.correra. The questions are:

1. Should we EVER give a you-might-have-meant hint in a case like this?
2. If so, does it matter whether the RTE name is just a bit different
from the actual RTE or whether it's completely different? In other
words, might we skip the hint in the above case but give one for
alvara.correra?

My current feeling is that we should answer #1 "no", but Peter prefers
to answer it "yes". My further feeling is that if we do decide to say
"yes" to #1, then I would answer #2 as "yes" also, but Peter would
answer it "no", assigning a fixed penalty for a mismatched RTE rather
than one that varies by the Levenshtein distance between the RTEs.

If no one else expresses an opinion, I'm going to insist on doing it
my way, but I'm happy to have other people weigh in.

Thanks,

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-12-15 16:47:04 Re: Commit fest 2014-12, let's begin!
Previous Message Adam Brightwell 2014-12-15 16:42:05 Re: Role Attribute Bitmask Catalog Representation