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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
Cc: Petr Korobeinikov <pkorobeinikov(at)gmail(dot)com>, Jeevan Chalke <jeevan(dot)chalke(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql :: support for \ev viewname and \sv viewname
Date: 2015-07-03 16:30:52
Message-ID: 9640.1435941052@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2015-07-03 16:39:42 Re: WAL logging problem in 9.4.3?
Previous Message Tom Lane 2015-07-03 15:44:42 Re: pgbench - allow backslash-continuations in custom scripts