Re: [GENERAL] pg_relation_size / could not open relation with OID #

2010-10-07 Thread Greg Smith
Tom Lane wrote: We could prevent your query from failing if we did something like having pg_relation_size() return NULL, rather than throwing an error, if the OID it's given doesn't turn out to correspond to a live table. I'm not sure if that'd be a net improvement or not --- it certainly seems

Re: [GENERAL] pg_relation_size / could not open relation with OID #

2010-10-07 Thread Tom Lane
Greg Smith g...@2ndquadrant.com writes: Tom Lane wrote: We could prevent your query from failing if we did something like having pg_relation_size() return NULL, rather than throwing an error, if the OID it's given doesn't turn out to correspond to a live table. I'm not sure if that'd be a

Re: [GENERAL] pg_relation_size / could not open relation with OID #

2010-10-07 Thread Tom Lane
I wrote: Greg Smith g...@2ndquadrant.com writes: I've struggled with scripts using pg_relation_size doing strange things because of this more than once. How about a) return NULL and b) log at NOTICE that you just asked for something undefined? I don't care for the NOTICE at all; it's just

Re: [GENERAL] pg_relation_size / could not open relation with OID #

2010-10-07 Thread Greg Smith
Tom Lane wrote: It strikes me that if we were willing to throw code at the problem, we could make it work like this: ... This would properly throw error for cases where you'd passed the wrong catalog's OID column to pg_relation_size. Yeah, you're right that is the proper way to handle this.

Re: [GENERAL] pg_relation_size / could not open relation with OID #

2010-10-07 Thread Tom Lane
Greg Smith g...@2ndquadrant.com writes: Yeah, you're right that is the proper way to handle this. As the problem isn't that serious once you're aware of it, I don't see a large amount of motivation to work on that now though, if that's what it will take to fix. And Tomas seemed satisfied

Re: [GENERAL] pg_relation_size / could not open relation with OID #

2010-09-21 Thread Tomas Vondra
OK, I'm a bit confused now. So it's not a race condition (i.e. a bug) in a pg_relation_size but a feature? Well, feature is in the eye of the beholder I guess. The race condition is not really avoidable; certainly pg_relation_size() can't do anything to prevent it. And you do *not* want

[GENERAL] pg_relation_size / could not open relation with OID #

2010-09-20 Thread tv
Hi everyone, I've run into a strange problem with system catalogs - we're collecting database stats periodically (every 10 minutes), and from time to time we get the following error: -- ERROR: could not open relation with OID 154873708

Re: [GENERAL] pg_relation_size / could not open relation with OID #

2010-09-20 Thread Tom Lane
t...@fuzzy.cz writes: I've run into a strange problem with system catalogs - we're collecting database stats periodically (every 10 minutes), and from time to time we get the following error: -- ERROR: could not open relation with OID

Re: [GENERAL] pg_relation_size / could not open relation with OID #

2010-09-20 Thread Tomas Vondra
Dne 20.9.2010 15:44, Tom Lane napsal(a): t...@fuzzy.cz writes: I've run into a strange problem with system catalogs - we're collecting database stats periodically (every 10 minutes), and from time to time we get the following error: -- ERROR:

Re: [GENERAL] pg_relation_size / could not open relation with OID #

2010-09-20 Thread Tom Lane
Tomas Vondra t...@fuzzy.cz writes: Dne 20.9.2010 15:44, Tom Lane napsal(a): I think you're probably hitting a problem with a table being deleted while you're scanning pg_class. pg_relation_size() will fail if the given OID isn't valid now --- but the underlying query returns all OIDs that