From: | "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: custom function for converting human readable sizes to bytes |
Date: | 2016-01-04 17:17:52 |
Message-ID: | CACACo5QOb6mtw1WGjaSXkuC8KnaEELJVR=cy-0eSeJ+r3VVjhQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Jan 4, 2016 at 6:14 PM, Robert Haas <robertmhaas(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2016-01-04 17:24:35 | Re: custom function for converting human readable sizes to bytes |
Previous Message | Robert Haas | 2016-01-04 17:15:27 | Re: Some 9.5beta2 backend processes not terminating properly? |