"Len Morgan" <len-morgan@crcom.net> writes:
> I am trying to copy a table from my local database to a client's. The
> problem is I keep getting a message from pg_dump:
> "can't find template1 database. You are really hosed."
Wow --- that does fall in the category of "shouldn't happen" errors.
(I assume you didn't do anything as silly as DROP DATABASE template1,
right?) The code that's coming out of is in src/bin/pg_dump/pg_dump.c:
res = PQexec(g_conn,
"SELECT oid from pg_database where datname = 'template1'");
if (res == NULL ||
PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr, "pg_dump error in finding the template1 database. Explanation from backend: '%s'.\n",
PQerrorMessage(g_conn));
exit_nicely(g_conn);
}
ntups = PQntuples(res);
if (ntups != 1)
{
fprintf(stderr, "pg_dump: couldn't find the template1 database. "
"You are really hosed.\nGiving up.\n");
exit_nicely(g_conn);
}
and offhand I don't see how that could go wrong short of truly-spectacular
failures. What do you see if you execute "SELECT oid,datname from
pg_database" by hand? What shows up in the postmaster log?
regards, tom lane