Fw: pg_dump help -- Problem Fixed -- Thank you all!!! - Mailing list pgsql-general

From Len Morgan
Subject Fw: pg_dump help -- Problem Fixed -- Thank you all!!!
Date
Msg-id 007801c000fd$5ff9b4a0$0908a8c0@H233.bstx.cc
Whole thread Raw
List pgsql-general
Len Morgan wrote:

>> the problem is I keep getting a message from pg_dump:
>>
>> "can't find template1 database.  You are really hosed."
>>

To which Tom Lane responded:

>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?
>

What I found was:

How about TWO template1 databases?!!  Is this the beginning of a replication
feature?  :-)  If so, it still needs a little polish.

Another response to my question:

Mike Mascari provided a little more insight to the problem:

>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:

Looks like that's what I have!

rcdc=> select oid,datname from pg_database ;
    oid|datname
-------+---------
  17120|template1
8419488|rcdc
5317312|bscc
8418112|template1 <- two for the price of one! :-)
8419520|sfcadc
7606304|sfcdc
9046752|test


And so I tried Mike's suggestion:

delete from pg_database where oid = 8418112 ;  (I assumed that the lower
numbered one is the "keeper")

and viola! my problem went away.  Thanks to all who offered help.

NOTICE TO NEWBIES:  These are the numbers on MY system. YMMV and your oid#
8418112 could be something useful!!!

I would have to wonder though, if this can cause so much "damage" why
wouldn't the datname field be specified as UNIQUE?  Do those kinds of things
work on system tables too?  Just curious.

Len Morgan



pgsql-general by date:

Previous
From: "Romanenko Mikhail"
Date:
Subject: Re: Trouble with float4 after upgrading from 6.5.3 to 7.0.2
Next
From: Steve Heaven
Date:
Subject: Query plan and sub-queries