Re: [SQL] how to get more detailed error messages?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] how to get more detailed error messages?
Дата
Msg-id 28259.1018633206@sss.pgh.pa.us
обсуждение исходный текст
Ответ на how to get more detailed error messages?  (Markus Wagner <wagner@imsd.uni-mainz.de>)
Ответы Re: [SQL] how to get more detailed error messages?  (Alvaro Herrera <alvherre@atentus.com>)
Re: [SQL] how to get more detailed error messages?  ("Josh Berkus" <josh@agliodbs.com>)
Список pgsql-general
Markus Wagner <wagner@imsd.uni-mainz.de> writes:
> we have a union query over three select queries with some hundred lines of
> SQL code, created as a view.

> When executing the code we get an error message "ERROR:  UNION types "text"
> and "int4" not matched" with only the line number of the terminating
> semicolon included.

> Isn't there a way to get the parser to talk more precisely???

Not at present.  This sort of error comes from deep inside the parser;
the code is working with a querytree that does not have any direct
connection anymore to source text.  Line numbers are not to be had,
and your suggestion of variable names is rather pointless also, at
least for this example --- there's no guarantee that the expressions
causing the problem involve any variables at all.

I have occasionally toyed with the idea of labeling querytree elements
with back-pointers showing the segment of source text that they came
from, but AFAICT this would impose a nontrivial cost on parsing activity
--- a cost that'd be paid all the time, even on correct queries.  Not
sure if it'd be a net benefit or not.

            regards, tom lane

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

Предыдущее
От: postgresql@fruru.com
Дата:
Сообщение: Re: [HACKERS] [Fwd: AW: More UB-Tree patent information]
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [SQL] how to get more detailed error messages?