Here's a test case for a pg_total_relation_size() failure:
test=> CREATE TABLE foo (id integer);
CREATE TABLE
test=> SELECT oid, relfilenode FROM pg_class WHERE relname = 'foo';
oid | relfilenode
-------+-------------
26235 | 26235
(1 row)
test=> SELECT pg_total_relation_size('foo');
pg_total_relation_size
------------------------
0
(1 row)
test=> TRUNCATE foo;
TRUNCATE TABLE
test=> SELECT oid, relfilenode FROM pg_class WHERE relname = 'foo';
oid | relfilenode
-------+-------------
26235 | 26237
(1 row)
test=> SELECT pg_total_relation_size('foo');
ERROR: could not open relation with OID 26237
test=> SELECT pg_total_relation_size(26235);
ERROR: could not open relation with OID 26237
test=> SELECT pg_relation_size('foo');
pg_relation_size
------------------
0
(1 row)
--
Michael Fuhr