Re: BUG #13832: Syntax errors are extremely unfriendly

Поиск
Список
Период
Сортировка
От Tim Hutt
Тема Re: BUG #13832: Syntax errors are extremely unfriendly
Дата
Msg-id CAKuVd4AafYiCafieV03AEguXKoiFGEzk0Z5zpccw1+A3+0hChg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #13832: Syntax errors are extremely unfriendly  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #13832: Syntax errors are extremely unfriendly  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Ah OK I guess this is an issue with Bison - theoretically it should be able
to say what it expects when it gets an invalid token right?
On 24 Dec 2015 16:11, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:

> tdhutt@gmail.com writes:
> > When you have a syntax error in PostgreSQL (or MySQL for that matter) you
> > get a message like this:
> >> ERROR: syntax error at or near "FROM"
> >> Position: 8
> > This is not very user-friendly to put it mildly!
>
> Well, at least some of that is on the head of whatever client-side
> software you're using.  psql, for example, produces an error cursor
> like this:
>
> regression=# select * from from tab;
> ERROR:  syntax error at or near "from"
> LINE 1: select * from from tab;
>                       ^
>
> > Compare this with Clang's
> > error messages (http://clang.llvm.org/diagnostics.html) which give you
> the
> > exact location of the error, and also what was expected, and even
> > suggestions to fix it!
>
> As far as raw syntax errors go, we're pretty much limited by what Bison
> will do; we're unlikely to implement our own parser from scratch just
> to improve this.  We do go to considerable lengths for semantic errors,
> eg in PG 9.5 you might get something like this for a misspelled column
> name:
>
> regression=# select unnique1 from tenk1;
> ERROR:  column "unnique1" does not exist
> LINE 1: select unnique1 from tenk1;
>                ^
> HINT:  Perhaps you meant to reference the column "tenk1.unique1".
>
>                         regards, tom lane
>

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #13770: Extending recovery_min_apply_delay on Standby causes it to be unavailable for a while
Следующее
От: Alexey Alexeev
Дата:
Сообщение: psql.exe error near '^'