1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

psql -f -

Adjust psql -f - to behave like a normal file and honor the -1 flag.

Report from Robert Haas
This commit is contained in:
Bruce Momjian
2009-12-01 22:34:33 +00:00
parent 0d32342501
commit b291c0fba8
2 changed files with 10 additions and 5 deletions

View File

@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.211 2009/11/22 05:20:41 tgl Exp $
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.212 2009/12/01 22:34:33 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
@ -1691,8 +1691,13 @@ process_file(char *filename, bool single_txn)
if (!filename)
return EXIT_FAILURE;
canonicalize_path(filename);
fd = fopen(filename, PG_BINARY_R);
if (strcmp(filename, "-") != 0)
{
canonicalize_path(filename);
fd = fopen(filename, PG_BINARY_R);
}
else
fd = stdin;
if (!fd)
{