http://www.postgresql.org/docs/8.4/static/functions-admin.html says:
pg_relation_size
accepts the OID or name of a table, index or toast table, and returns the size in bytes
However when I use it with a valid table name, I get the error:
column [table] does not exist…
I know my table exists, because doing
SELECT count(*) FROM [table]
returns a valid number. Any ideas?
Try explicitely adding the schema (e.g. ‘public’) where the table is located in the pg_relation_size call.
Like this (untested):