Re: Doing better at HINTing an appropriate column within errorMissingColumn()
От | Albe Laurenz |
---|---|
Тема | Re: Doing better at HINTing an appropriate column within errorMissingColumn() |
Дата | |
Msg-id | A737B7A37273E048B164557ADEF4A58B17CE8DEA@ntex2010i.host.magwien.gv.at обсуждение исходный текст |
Ответ на | Doing better at HINTing an appropriate column within errorMissingColumn() (Peter Geoghegan <pg@heroku.com>) |
Ответы |
Re: Doing better at HINTing an appropriate column within
errorMissingColumn()
Re: Doing better at HINTing an appropriate column within errorMissingColumn() |
Список | pgsql-hackers |
Peter Geoghegan wrote: > With the addition of LATERAL subqueries, Tom fixed up the mechanism > for keeping track of which relations are visible for column references > while the FROM clause is being scanned. That allowed > errorMissingColumn() to give a more useful error to the one produced > by the prior coding of that mechanism, with an errhint sometimes > proffering: 'There is a column named "foo" in table "bar", but it > cannot be referenced from this part of the query'. > > I wondered how much further this could be taken. Attached patch > modifies contrib/fuzzystrmatch, moving its Levenshtein distance code > into core without actually moving the relevant SQL functions too. That > change allowed me to modify errorMissingColumn() to make more useful > suggestions as to what might have been intended under other > circumstances, like when someone fat-fingers a column name. > [local]/postgres=# select * from orders o join orderlines ol on o.orderid = ol.orderids limit 1; > ERROR: 42703: column ol.orderids does not exist > LINE 1: ...* from orders o join orderlines ol on o.orderid = ol.orderid... > ^ > HINT: Perhaps you meant to reference the column "ol"."orderid". This sounds like a mild version of DWIM: http://www.jargondb.org/glossary/dwim Maybe it is just me, but I get uncomfortable when a program tries to second-guess what I really want. Yours, Laurenz Albe
В списке pgsql-hackers по дате отправления: