Re: pg_relation_size, relation does not exist

From: Whit Armstrong <armstrong(dot)whit(at)gmail(dot)com>
To: Frank Heikens <frankheikens(at)mac(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_relation_size, relation does not exist
Date: 2009-06-16 11:52:45
Message-ID: 8ec76080906160452x30803ben3c381dabe0ae6ed7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks, Frank.

That works perfectly.

Cheers,
Whit

On Tue, Jun 16, 2009 at 7:36 AM, Frank Heikens<frankheikens(at)mac(dot)com> wrote:
> The search_path isn't correct. You're looking for the size of tables in
> schema 'econ' but you don't mention this schema inside the function
> pg_relation_size(). Try to  use the schemanames as well, saves you a lot of
> problems with assumptions.
>
> This one should work:
>
> SELECT
>        tablename,
>        pg_size_pretty(pg_relation_size(schemaname || '.' || tablename))
> FROM
>        pg_tables
> WHERE
>        schemaname = 'econ';
>
>
> Kind regard,
> Frank
>
>
> Op 16 jun 2009, om 13:17 heeft Whit Armstrong het volgende geschreven:
>
>> Does anyone know why I get an unknown relation error when I query for
>> relation size?
>>
>> kls=# select tablename, pg_size_pretty(pg_relation_size(tablename))
>> from pg_tables where schemaname = 'econ' order by tablename;
>> ERROR:  relation "series_info" does not exist
>> kls=#
>>
>> Is there a better way to do this query to avoid this error?
>>
>> Thanks,
>> Whit
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2009-06-16 11:59:19 Re: Dynamic table
Previous Message Greg Stark 2009-06-16 11:50:28 Re: Custom Fields Database Architecture