Re: psql line number reporting from stdin

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql line number reporting from stdin
Date: 2011-11-28 17:45:06
Message-ID: 1322502178-sup-9320@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Excerpts from Peter Eisentraut's message of sáb nov 26 17:36:15 -0300 2011:
> There is a long-standing oddity in psql that running
>
> psql -f foo.sql
>
> returns error messages with file name and line number, like
>
> psql:foo.sql:1: ERROR: syntax error at or near "foo"
>
> but running
>
> psql < foo.sql does not. I suggest we change the latter to print
>
> psql:<stdin>:1: ERROR: syntax error at or near "foo"

Not that I have ever used psql in this way, but this format is compatible
with Vim "quickfix" whereas the old one is not (not sure what Emacs
people would call this). Presumably, this being useless with <stdin> as
a file name is the reason this wasn't implemented in the first place.

+1 on the change.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2011-11-28 17:48:27 Re: pgsql: Make pg_dumpall build with the right object files under MSVC.
Previous Message Andrew Dunstan 2011-11-28 17:40:24 Re: pgsql: Make pg_dumpall build with the right object files under MSVC.