Re: pg_dump help - Mailing list pgsql-general

From Tom Lane
Subject Re: pg_dump help
Date
Msg-id 18537.965706892@sss.pgh.pa.us
Whole thread Raw
In response to pg_dump help  ("Len Morgan" <len-morgan@crcom.net>)
List pgsql-general
"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

pgsql-general by date:

Previous
From: Philip Warner
Date:
Subject: Re: [HACKERS] Re: Trouble with float4 afterupgrading from 6.5.3 to 7.0.2
Next
From: "Romanenko Mikhail"
Date:
Subject: Re: Trouble with float4 after upgrading from 6.5.3 to 7.0.2