Re: pg_dump help - Mailing list pgsql-general

From Mike Mascari
Subject Re: pg_dump help
Date
Msg-id 398F30FB.82FA9C82@mascari.com
Whole thread Raw
In response to pg_dump help  ("Len Morgan" <len-morgan@crcom.net>)
List pgsql-general
Len Morgan wrote:
>
> 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."
>
> The docs say that this usually means the postmaster is not running but it
> is.  In fact, I can get into the database and do whatever I want to with it.
> Over the weekend I did try and install the 7.0.2 RPMS without much luck.  I
> uninstalled them and reinstalled 6.5.1-3.  I then reloaded my databases.
> This is the first time I've done a pg_dump since.  pg_dumpall gives me the
> same error.
>
> If you've got any advice on how I can save these two tables I need so I can
> get them to my customer I'd appreciate it.
>
> Redhat 6.0 OS
>
> len morgan

In 6.x, pg_database sometimes became out of sync. Perform a:

SELECT oid, * FROM pg_database;

That error is usually a symptom of either a missing entry for
template1 or a duplicate entry. If it is missing, you'll have to
add the record yourself with an insert:

INSERT INTO pg_database VALUES ('template1', 100, 0,
'template1');

If there are duplicates, delete the duplicate:

DELETE FROM pg_database WHERE oid = X;

where 'X' is the oid of the duplicate.

Hope that helps,

Mike Mascari

pgsql-general by date:

Previous
From:
Date:
Subject: Re: [HACKERS] Re: Trouble with float4 afterupgrading from 6.5.3 to 7.0.2
Next
From: Stephan Szabo
Date:
Subject: Re: foreign keys