pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: valen@tuatha.org
Cc: postgres <pgsql-admin@postgresql.org>
Subject: Re: Postgres db corrupted ?
Date: Tue, 29 Jul 2003 12:55:04 -0400
Message-ID: <29907.1059497704@sss.pgh.pa.us> (raw)
In-Reply-To: <20030729162256.GA5304@magicbluesmoke.net>
References: <1059470890.5588.41.camel@cosimo.hosting365.ie>
	<21943.1059489530@sss.pgh.pa.us>
	<20030729162256.GA5304@magicbluesmoke.net>

"John P. Looney" <valen@tuatha.org> writes:
>> If no go, could we see the output of "select * from pg_database"?

>  Yep, no worries...

> postgres=# select * from pg_database;
>      datname     | datdba | encoding | datistemplate | datallowconn | datlastsysoid | datvacuumxid | datfrozenxid | datpath
> -----------------+--------+----------+---------------+--------------+---------------+--------------+--------------+---------
>  bbadmin         |        |        0 | f             | t            |         16554 |           49 |           49 |

Hm, that datdba field actually is NULL, isn't it?  That's what you need
to fix.  The low-level code isn't expecting it to be NULL, and falls
over in surprising ways.  (Recent releases try to enforce NOT NULL on
system catalog columns that mustn't be NULL, but I'm not sure how
bulletproof that really is.)

I'd try

UPDATE pg_database SET datdba = <something reasonable> WHERE datdba IS NULL;

You could just set them all to 1 (the postgres userid); if you want
these databases owned by specific users then see pg_shadow.usesysid for
the numbers to insert.

Once you have all the entries fixed, do the "VACUUM FULL pg_database"
fandango for good luck, and you should be back in business.

			regards, tom lane



view thread (13+ messages)  latest in thread

Message-ID: <29907.1059497704@sss.pgh.pa.us>
Permalink:  ../29907.1059497704@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29907.1059497704@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, valen@tuatha.org
  Subject: Re: Postgres db corrupted ?
  In-Reply-To: <29907.1059497704@sss.pgh.pa.us>
  References: <1059470890.5588.41.camel@cosimo.hosting365.ie> <21943.1059489530@sss.pgh.pa.us> <20030729162256.GA5304@magicbluesmoke.net> <29907.1059497704@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox