Re: PostgreSQL 9.0b1 - Error when checking table sizes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PostgreSQL 9.0b1 - Error when checking table sizes
Дата
Msg-id 9142.1274997600@sss.pgh.pa.us
обсуждение исходный текст
Ответ на PostgreSQL 9.0b1 - Error when checking table sizes  (Thom Brown <thombrown@gmail.com>)
Ответы Re: PostgreSQL 9.0b1 - Error when checking table sizes  (Thom Brown <thombrown@gmail.com>)
Список pgsql-bugs
Thom Brown <thombrown@gmail.com> writes:
> This probably isn't a legitimate bug, but as a precaution....
> I'm running the following command against PostgreSQL 9.0 beta 1:

> psql -U postgres -d test -c "select tablename,
> pg_size_pretty(pg_table_size(tablename::regclass)) from pg_tables
> order by tablename;"

> And getting the following message:

> ERROR:  relation "sql_sizing" does not exist

The "tablename::regclass" bit is guaranteed to fail for any relation
that's not in your current search_path, because you're just handing
an unqualified name to the regclass converter.

If you're absolutely intent on using the pg_tables view here, you
could do this instead:
    (quote_ident(schemaname) || '.' || quote_ident(tablename))::regclass

Frankly though this seems like quite the hard way.  Why not just

select relname, pg_size_pretty(pg_table_size(oid)) from pg_class
where relkind = 'r'
order by relname;

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: PostgreSQL 9.0b1 - Error when checking table sizes
Следующее
От: Thom Brown
Дата:
Сообщение: Re: PostgreSQL 9.0b1 - Error when checking table sizes