Re: psql :: support for \ev viewname and \sv viewname

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: psql :: support for \ev viewname and \sv viewname
Дата
Msg-id 9640.1435941052@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: psql :: support for \ev viewname and \sv viewname  (Jeevan Chalke <jeevan.chalke@enterprisedb.com>)
Ответы Re: psql :: support for \ev viewname and \sv viewname  (Petr Korobeinikov <pkorobeinikov@gmail.com>)
Список pgsql-hackers
Jeevan Chalke <jeevan.chalke@enterprisedb.com> writes:
> Patch looks excellent now. No issues.
> Found a typo which I have fixed in the attached patch.

Starting to look at this ...

The business with numbering lines from SELECT seems to me to be completely
nonsensical.  In the first place, it fails to allow for views containing
WITH clauses.  But really it looks like it was cargo-culted over from
\ef/\sf without understanding why those commands number lines the way
they do.  The reason they do that is that for errors occurring inside a
function definition, the PL will typically report a line number relative
to the function body text, and so we're trying to be helpful about
interpreting line numbers of that kind.  But there's no comparable
behavior in the case of a view.  If you fat-finger a view, you'll get
a line number relative to the text of the whole CREATE command, eg

regression=# create or replace view z as
regression-# select 1/col
regression-# from bar;
ERROR:  relation "bar" does not exist
LINE 3: from bar;            ^

So AFAICS, \ev and \sv should just number lines straightforwardly, with
"1" being the first line of the CREATE command text.  Am I missing
something?
        regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgbench - allow backslash-continuations in custom scripts
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: WAL logging problem in 9.4.3?