tags:

views:

37

answers:

1

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?

+1  A: 

Try explicitely adding the schema (e.g. 'public') where the table is located in the pg_relation_size call.

Like this (untested):

select pg_relation_size(public.mytablename) from pg_tables
ChristopheD
thanks mate....
pstanton
actually, same error ! should have checked first... looking for answers....
pstanton
You may need to do use '': select pg_relation_size('public.mytablename') from pg_tables
ChristopheD
i am a doofus! i had double quotes ... thanks again, works now.
pstanton
ps 'from pg_tables' is not necessary, your first answer (unedited) was correct.
pstanton
No problem, glad it worked ;-)
ChristopheD