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 to
> reduce the system's ability to detect simple errors
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? That would let
scripts run without interruption in some of these race condition cases,
while still generating some clue the user was likely to see that there
was a problem when people were just using the thing blatantly wrong--the
biggest subset of cases that produce errors now I suspect.
--
Greg Smith, 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD
PostgreSQL Training, Services and Support www.2ndQuadrant.us