Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit89c2f57

Browse files
committed
psql: Improve error display for psql -f -
Running "psql -f -" used to printpsql:<stdin>:1: ERROR: blahbut that got broken between 8.4 and 9.0 (commitb291c0f), and now it printedpsql:-:1: ERROR: blahThis reverts to the old behavior and cleans up some code that was leftdead or useless by the mentioned commit.
1 parent3433c6b commit89c2f57

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

‎src/bin/psql/command.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,14 +2062,17 @@ process_file(char *filename, bool single_txn, bool use_relative_path)
20622062
}
20632063

20642064
fd=fopen(filename,PG_BINARY_R);
2065+
2066+
if (!fd)
2067+
{
2068+
psql_error("%s: %s\n",filename,strerror(errno));
2069+
returnEXIT_FAILURE;
2070+
}
20652071
}
20662072
else
2067-
fd=stdin;
2068-
2069-
if (!fd)
20702073
{
2071-
psql_error("%s: %s\n",filename,strerror(errno));
2072-
returnEXIT_FAILURE;
2074+
fd=stdin;
2075+
filename="<stdin>";/* for future error messages */
20732076
}
20742077

20752078
oldfilename=pset.inputfile;

‎src/bin/psql/startup.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,6 @@ main(int argc, char *argv[])
313313
printf(_("Type \"help\" for help.\n\n"));
314314
if (!pset.notty)
315315
initializeInput(options.no_readline ?0 :1);
316-
if (options.action_string)/* -f - was used */
317-
pset.inputfile="<stdin>";
318316

319317
successResult=MainLoop(stdin);
320318
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp