>From e3a6633ec2782264f3a87fbe3be079f94d89b911 Mon Sep 17 00:00:00 2001
From: Craig Ringer <craig@2ndquadrant.com>
Date: Fri, 17 Oct 2014 12:07:37 +0800
Subject: [PATCH 2/2] If the input path to psql is a directory, mention
 pg_restore in the error

This should help users who try to use psql to restore a directory-format
dump from pg_dump.
---
 src/bin/psql/input.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index 6416ab9..e332318 100644
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -191,8 +191,15 @@ gets_fromFile(FILE *source)
 		{
 			if (ferror(source))
 			{
-				psql_error("could not read from input file: %s\n",
-						   strerror(errno));
+				/*
+				 * Could the user be trying to restore a directory
+				 * format dump?
+				 */
+				if (errno == EISDIR)
+					psql_error("Input path is a directory. Use pg_restore to restore directory-format database dumps.\n");
+				else
+					psql_error("could not read from input file: %s\n",
+							   strerror(errno));
 				return NULL;
 			}
 			break;
-- 
1.9.3

