Re: pg_relation_size / could not open relation with OID # - Mailing list pgsql-general

From Greg Smith
Subject Re: pg_relation_size / could not open relation with OID #
Date
Msg-id 4CADCE3E.60705@2ndquadrant.com
Whole thread Raw
In response to Re: pg_relation_size / could not open relation with OID #  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_relation_size / could not open relation with OID #
List pgsql-general
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



pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: VACUUM FULL for performance
Next
From: Tom Lane
Date:
Subject: Re: stuck spinlock detected at dynahash.c