1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

psql: Improve error display for psql -f -

Running "psql -f -" used to print

psql:<stdin>:1: ERROR:  blah

but that got broken between 8.4 and 9.0 (commit
b291c0fba8), and now it printed

psql:-:1: ERROR:  blah

This reverts to the old behavior and cleans up some code that was left
dead or useless by the mentioned commit.
This commit is contained in:
Peter Eisentraut
2012-03-01 19:58:10 +02:00
parent 3433c6ba00
commit 89c2f573a3
2 changed files with 8 additions and 7 deletions

View File

@ -2062,14 +2062,17 @@ process_file(char *filename, bool single_txn, bool use_relative_path)
}
fd = fopen(filename, PG_BINARY_R);
if (!fd)
{
psql_error("%s: %s\n", filename, strerror(errno));
return EXIT_FAILURE;
}
}
else
fd = stdin;
if (!fd)
{
psql_error("%s: %s\n", filename, strerror(errno));
return EXIT_FAILURE;
fd = stdin;
filename = "<stdin>"; /* for future error messages */
}
oldfilename = pset.inputfile;