Re: Postgres db corrupted ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Postgres db corrupted ?
Дата
Msg-id 29907.1059497704@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Postgres db corrupted ?  ("John P. Looney" <valen@tuatha.org>)
Ответы Re: Postgres db corrupted ?
Список pgsql-admin
"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

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Benjamin Thelen (CCGIS)"
Дата:
Сообщение: changing ownership of db
Следующее
От: "John P. Looney"
Дата:
Сообщение: Re: Postgres db corrupted ?