Skip to content

Commit 65a2c8f

Browse files
committed
Improve pg_dump template1 error reports.
1 parent 5883563 commit 65a2c8f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.121 1999/10/10 14:42:44 momjian Exp $
24+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.122 1999/10/10 17:00:26 momjian Exp $
2525
*
2626
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2727
*
@@ -3075,11 +3075,16 @@ findLastBuiltinOid(void)
30753075
exit_nicely(g_conn);
30763076
}
30773077
ntups = PQntuples(res);
3078-
if (ntups != 1)
3078+
if (ntups < 1)
30793079
{
30803080
fprintf(stderr,"pg_dump: couldn't find the template1 database.\n");
3081-
fprintf(stderr,"Check the table pg_database for a problem.\n");
3082-
fprintf(stderr,"There should be exactly one 'template1' entry\n");
3081+
fprintf(stderr,"There is no 'template1' entry in the 'pg_database' table.\n");
3082+
exit_nicely(g_conn);
3083+
}
3084+
if (ntups > 1)
3085+
{
3086+
fprintf(stderr,"pg_dump: found more than one template1 database.\n");
3087+
fprintf(stderr,"There is more than one 'template1' entry in the 'pg_database' table\n");
30833088
exit_nicely(g_conn);
30843089
}
30853090
last_oid = atoi(PQgetvalue(res, 0, PQfnumber(res, "oid")));

0 commit comments

Comments
 (0)