0

Occasionally, I get the following error while doing a simple pg_dump ( pg_dump -U postgres -Fc -f mybackup.dmp mydb):

pg_dump: [archiver (db)] query failed: ERROR:  could not open relation with OID 11072443
    pg_dump: [archiver (db)] query was: SELECT pg_catalog.pg_get_viewdef('11072443'::pg_catalog.oid) AS viewdef

The dump is then aborted.

I'm using PostgreSQL and pg_dump 9.2.2 for Windows.

Solutions welcome.

3
  • The latest 9.2 is 9.2.9. Could you reproduce it with it? Commented Oct 20, 2014 at 21:26
  • The fact that it is occasional is interesting. Any antivirus software on the computer? That's a common culprit. Commented Oct 20, 2014 at 21:31
  • Is it the same OID each time you get the error? If so, I'm betting on database corruption. Can you convert that OID to a table name (SELECT 11072443::regclass), and COPY that table manually to a file? Commented Oct 21, 2014 at 12:47

1 Answer 1

2

Thanks guys for the suggestions, I think I found the problem.

Each night, several bash scripts drop and recreate some tables, which each time get a new OID. This would explain why a different OID was appearing in each successive error message, as suggested by Josh.

I believe that on some occasions, pg_dump started while some of these tables were still being dropped/recreated, hence the error message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.