Skip site navigation (1) Skip section navigation (2)

Re: psql line number reporting from stdin

From: Nathan Wagner <nw(at)hydaspes(dot)if(dot)org>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql line number reporting from stdin
Date: 2011-11-28 22:12:20
Message-ID: a197d0d042e4d173d94ba3b923a1148f@granicus.if.org (view raw or flat)
Thread:
Lists: pgsql-hackers
On Sat, 26 Nov 2011 22:36:15 +0200, Peter Eisentraut wrote:
> 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.

No issue with the change itself, but the docs claim
that

"the variant using the shell's input redirection is
(in theory) guaranteed to yield exactly the same output
you would have received had you entered everything by hand."

-- 
nw

In response to

pgsql-hackers by date

Next:From: Jim NasbyDate: 2011-11-29 01:07:28
Subject: Re: strange nbtree corruption report
Previous:From: Bruce MomjianDate: 2011-11-28 21:47:52
Subject: Re: [PATCH] Replace a long chain of if's in eval_const_expressions_mutator by a switch()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group