aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2012-08-09 09:59:45 -0400
committerRobert Haas <rhaas@postgresql.org>2012-08-09 10:02:50 -0400
commitbe690e291d59e8d0c9f4df59abe09f1ff6cc0da9 (patch)
tree7caef7285152bac1818ff8665808224093caa184 /src/bin/psql/command.c
parent92ec0370eb65c4f059f2b60ee6e458b312bb7cbf (diff)
downloadpostgresql-be690e291d59e8d0c9f4df59abe09f1ff6cc0da9.tar.gz
postgresql-be690e291d59e8d0c9f4df59abe09f1ff6cc0da9.zip
Make psql -1 < file behave as expected.
Previously, the -1 option was silently ignored. Also, emit an error if -1 is used in a context where it won't be respected, to avoid user confusion. Original patch by Fabien COELHO, but this version is quite different from the original submission.
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 8abadb26c49..6ead800aeb1 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -2043,9 +2043,11 @@ process_file(char *filename, bool single_txn, bool use_relative_path)
PGresult *res;
if (!filename)
- return EXIT_FAILURE;
-
- if (strcmp(filename, "-") != 0)
+ {
+ fd = stdin;
+ filename = NULL;
+ }
+ else if (strcmp(filename, "-") != 0)
{
canonicalize_path(filename);