Re: PostgreSQL 9.0b1 - Error when checking table sizes

Поиск
Список
Период
Сортировка
От Thom Brown
Тема Re: PostgreSQL 9.0b1 - Error when checking table sizes
Дата
Msg-id AANLkTilxCUs5H9hXijRI5JIhXVAlRYBkNgqcYWpGxZWi@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PostgreSQL 9.0b1 - Error when checking table sizes  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: PostgreSQL 9.0b1 - Error when checking table sizes  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-bugs
On 27 May 2010 23:00, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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: =A0relation "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:
> =A0 =A0 =A0 =A0(quote_ident(schemaname) || '.' || quote_ident(tablename))=
::regclass
>
> Frankly though this seems like quite the hard way. =A0Why not just
>
> select relname, pg_size_pretty(pg_table_size(oid)) from pg_class
> where relkind =3D 'r'
> order by relname;
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0regards, tom lane
>

Of course, you're both right.  I've changed it to:

psql -U postgres -d test -c "select tablename,
pg_size_pretty(pg_table_size(tablename::regclass)) from pg_tables
where schemaname =3D 'public' order by tablename;"

And this, for some reason, works... which is how I did it the other
day (hence why I've only just got the error today).

Apologies

Thom

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PostgreSQL 9.0b1 - Error when checking table sizes
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: PostgreSQL 9.0b1 - Error when checking table sizes