Re: pg_relation_size / could not open relation with OID #

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Smith <greg(at)2ndquadrant(dot)com>
Cc: Tomas Vondra <tv(at)fuzzy(dot)cz>, pgsql-general(at)postgresql(dot)org
Subject: Re: pg_relation_size / could not open relation with OID #
Date: 2010-10-07 14:10:27
Message-ID: 28177.1286460627@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greg Smith <greg(at)2ndquadrant(dot)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 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?

I don't care for the NOTICE at all; it's just useless log bloat (that
likely will never be seen by a human) in most use-cases. Either we
think this is an expected case, or not.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2010-10-07 14:14:26 Re: What was new in 8.4 & 8.3?
Previous Message Peter Geoghegan 2010-10-07 14:06:53 Re: PostgreSQL 7.4.16 is creating strange files under /var/lib/pgsql