psql line number reporting from stdin - Mailing list pgsql-hackers

From Peter Eisentraut
Subject psql line number reporting from stdin
Date
Msg-id 1322339775.8179.6.camel@vanquo.pezone.net
Whole thread Raw
Responses Re: psql line number reporting from stdin  (Robert Haas <robertmhaas@gmail.com>)
Re: psql line number reporting from stdin  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: psql line number reporting from stdin  (Nathan Wagner <nw@hydaspes.if.org>)
Re: psql line number reporting from stdin  (Peter Eisentraut <peter_e@gmx.net>)
Re: psql line number reporting from stdin  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
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"

Other examples for the use of the spelling "<stdin>" in this context
include gcc and slonik.

Error messages printed in interactive mode will not be affected, of
course.

Patch attached.

Attachment

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Patch: Perl xsubpp
Next
From: Andres Freund
Date:
Subject: Re: Avoiding repeated snapshot computation