BUG #4669: pg_dump reports error about multiple rows
BUG #4669: pg_dump reports error about multiple rows
От:
"Vitaly Lopatin" <vitaly.lopatin@gmail.com>
Дата:
The following bug has been logged online: Bug reference: 4669 Logged by: Vitaly Lopatin Email address: vitaly.lopatin@gmail.com PostgreSQL version: 8.3.6 Operating system: Red Hat Enterprise Linux 5.2 Description: pg_dump reports error about multiple rows Details: 1. In start I used 8.3.1. Once, I got error: ERROR: database is not accepting commands to avoid wraparound data loss in database "ppcs_ts" HINT: Stop the postmaster and use a standalone backend to vacuum database "ppcs_ts". 2. I'd stopped postgresql and upgrade to 8.3.6 3. I've started postgres in stanalone mode and run 'vacuum full'. 4. I've started postgres in standart mode without any errors. 5. I've run pg_dump and I've got: pg_dump: SQL command failed pg_dump: Error message from server: ERROR: more than one row returned by a subquery used as an expression pg_dump: The command was: SELECT tableoid, oid, typname, typnamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = typowner) as rolname, typinput ::oid as typinput, typoutput::oid as typoutput, typelem, typrelid, CASE WHEN typrelid = 0 THEN ' '::"char" ELSE (SELECT relkind FROM pg_class WHERE oid = typrelid) END as typrelkind, typtype, typisdefined, typname[0] = '_' AND typelem != 0 AND (SELECT typarray FROM pg_type te WHERE oid = pg_type.typelem) = oid AS isarray FROM pg_type 6. I run this query ppcs_ts=# select oid,count(*) from pg_class group by oid having count(*) > 1; oid | count -------+------- 23744 | 2 (1 row) and this query ppcs_ts=# select ctid,xmin,xmax,cmin,cmax,oid,* from pg_class where oid=23744; ctid | xmin | xmax | cmin | cmax | oid | relname | relnamespace | reltype | relowner | relam | relfilenode | reltablespace | relpages | reltuples | reltoastrelid | reltoastidxid | relhasindex | relisshared | relkind | relnatts | relchecks | reltriggers | relukeys | relfkeys | relrefs | relhasoids | relhaspkey | relhasrules | relhassubclass | relfrozenxid | relacl | reloptions ----------+------------+------+------------+------------+-------+----------- --------------+--------------+---------+----------+-------+-------------+--- ------------+----------+-----------+---------------+---------------+-------- -----+-------------+---------+----------+-----------+-------------+--------- -+----------+---------+------------+------------+-------------+------------- ---+--------------+--------+------------ (253,51) | 1713217376 | 0 | 6 | 6 | 23744 | ppcsc_ip_clicks_analyze | 16394 | 23746 | 16391 | 0 | 121017126 | 0 | 1 | 2 | 0 | 0 | t | f | r | 2 | 0 | 1 | 0 | 0 | 0 | f | t | f | f | 1713217349 | | (237,3) | 1650691925 | 0 | 1672983373 | 1672983373 | 23744 | ppcsc_ip_clicks_analyze | 16394 | 23746 | 16391 | 0 | 119761918 | 0 | 1 | 1 | 0 | 0 | t | f | r | 2 | 0 | 1 | 0 | 0 | 0 | f | t | f | f | 1650691905 | | (2 rows) How I can to fix this problem?
Re: BUG #4669: pg_dump reports error about multiple rows
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Vitaly Lopatin" writes: > 1. In start I used 8.3.1. Once, I got error: > ERROR: database is not accepting commands to avoid wraparound data loss in > database "ppcs_ts" How did you manage that? autovacuum should have taken preventive action long before you'd get any such warning. Are you using nondefault autovacuum settings, and if so what are they? > pg_dump: Error message from server: ERROR: more than one row returned by a > subquery used as an expression > pg_dump: The command was: SELECT tableoid, oid, typname, typnamespace, > (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = typowner) as rolname, > typinput Does vacuuming pg_class fix this? If not, try manually removing the older of the duplicate rows (select it by ctid). Make sure the one you leave behind has a relfilenode matching the table on disk. The whole thing looks like catalog corruption issues to me. Have you had any system crashes lately? Are you sure your disks are not configured to lie about write-complete? regards, tom lane