Re: custom function for converting human readable sizes to bytes

Поиск
Список
Период
Сортировка
От Shulgin, Oleksandr
Тема Re: custom function for converting human readable sizes to bytes
Дата
Msg-id CACACo5QOb6mtw1WGjaSXkuC8KnaEELJVR=cy-0eSeJ+r3VVjhQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: custom function for converting human readable sizes to bytes  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: custom function for converting human readable sizes to bytes  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Mon, Jan 4, 2016 at 6:14 PM, Robert Haas <robertmhaas@gmail.com> wrote:
On Mon, Jan 4, 2016 at 11:48 AM, Shulgin, Oleksandr
>
> postgres=# select pg_size_bytes('');
> ERROR:  invalid input syntax for type numeric: ""

I think that's a pretty bad error message.  I mean, the user is
calling a function that takes text as an input data type.  So, where's
numeric involved?

Is there a way to force CONTEXT output in the reported error?  I guess that could help.

I'm also kind of wondering what the intended use case for this
function is.  Why do we want it?  Do we want it?

As suggested above a usecase could be like the following:

SELECT relname FROM pg_class WHERE pg_relation_size(oid) > pg_size_bytes('100 GB');

I think it's neat and useful.

--
Alex

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Some 9.5beta2 backend processes not terminating properly?
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Additional role attributes && superuser review