pg_dump: SQL command failed - Mailing list pgsql-general

From Oliver Kohll - Mailing Lists
Subject pg_dump: SQL command failed
Date
Msg-id 546577B3-32B8-4335-928B-98D53216E4E1@gtwm.co.uk
Whole thread Raw
Responses Re: pg_dump: SQL command failed  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello,

I've just come across this in an output from a cron backup script:

/etc/cron.hourly/gtwm_backup_databases.sh:

pg_dump: SQL command failed
pg_dump: Error message from server: ERROR:  could not open relation with OID 572838
pg_dump: The command was: SELECT pg_catalog.pg_get_viewdef('572838'::pg_catalog.oid) AS viewdef

The complete script is

#!/bin/bash
nice /usr/bin/pg_dump -U postgres -f /var/local/backup/agilebaseschema_`/bin/date +%H`.sql agilebaseschema
nice /usr/bin/pg_dump -U postgres --exclude-table=dbint_log_* -f /var/local/backup/agilebasedata_`/bin/date +%H`.sql
agilebasedata

Running the script again manually, it works with no errors and I haven't noticed the error before. Unfortunately I
recentlydeleted my archive of cron results so I can't do an exhaustive check and I can't see anything in the postgres
logeither but it's the first time I've noticed it since I can remember. 

A web search shows other people have come across this before now and again though I can't see any resolutions. I'm
runningpostgres v8.4.1. 

Running that SELECT statement manually on both databases returns

agilebasedata=# SELECT pg_catalog.pg_get_viewdef('572838'::pg_catalog.oid) AS viewdef;
  viewdef
------------
 Not a view
(1 row)

Views are regularly altered, dropped and created in the agilebasedata database, 15 times today to date, which have all
succeededwithout error. 

Any help on what could cause that error?

Regards
Oliver Kohll
oliver@agilebase.co.uk / 0845 456 1810 / 07814 828608
www.agilebase.co.uk - software
www.gtwm.co.uk - company


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Weeding out unused user created database objects, could I use pg_catalog?
Next
From: "Igor Neyman"
Date:
Subject: Re: help with SQL join