[GENERAL] pg_dump: SQL command failed

2010-02-12 Thread Oliver Kohll - Mailing Lists
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 recently deleted my archive of cron 
results so I can't do an exhaustive check and I can't see anything in the 
postgres log either 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 running postgres 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 succeeded without error.

Any help on what could cause that error?

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


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] pg_dump: SQL command failed

2010-02-12 Thread Tom Lane
Oliver Kohll - Mailing Lists oliver.li...@gtwm.co.uk writes:
 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

Looks like a race condition  somebody dropped a view between the
pg_dump saw it and the time pg_dump tried to grab the view definition.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general