pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Add pg_size_bytes() to parse human-readable size strings.
9+ messages / 5 participants
[nested] [flat]
* pgsql: Add pg_size_bytes() to parse human-readable size strings.
@ 2016-02-20 10:07 Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:12 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Michael Paquier <michael.paquier@gmail.com>
2016-02-20 14:04 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Pavel Stehule <pavel.stehule@gmail.com>
0 siblings, 2 replies; 9+ messages in thread
From: Dean Rasheed @ 2016-02-20 10:07 UTC (permalink / raw)
To: pgsql-committers
Add pg_size_bytes() to parse human-readable size strings.
This will parse strings in the format produced by pg_size_pretty() and
return sizes in bytes. This allows queries to be written with clauses
like "pg_total_relation_size(oid) > pg_size_bytes('10 GB')".
Author: Pavel Stehule with various improvements by Vitaly Burovoy
Discussion: http://www.postgresql.org/message-id/CAFj8pRD-tGoDKnxdYgECzA4On01_uRqPrwF-8LdkSE-6bDHp0w@mail.gmail....
Reviewed-by: Vitaly Burovoy, Oleksandr Shulgin, Kyotaro Horiguchi,
Michael Paquier and Robert Haas
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/53874c5228fe16589a4d01b3e1fab3678e0fd8e3
Modified Files
--------------
doc/src/sgml/func.sgml | 32 +++++++-
src/backend/utils/adt/dbsize.c | 149 +++++++++++++++++++++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.h | 2 +
src/include/utils/builtins.h | 1 +
src/test/regress/expected/dbsize.out | 109 +++++++++++++++++++++++++
src/test/regress/sql/dbsize.sql | 39 +++++++++
7 files changed, 331 insertions(+), 3 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.
2016-02-20 10:07 pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
@ 2016-02-20 10:12 ` Michael Paquier <michael.paquier@gmail.com>
2016-02-20 10:16 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Michael Paquier <michael.paquier@gmail.com>
2016-02-20 10:17 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
1 sibling, 2 replies; 9+ messages in thread
From: Michael Paquier @ 2016-02-20 10:12 UTC (permalink / raw)
To: Dean Rasheed <dean.a.rasheed@gmail.com>; +Cc: pgsql-committers
On Sat, Feb 20, 2016 at 7:07 PM, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
> Add pg_size_bytes() to parse human-readable size strings.
>
> This will parse strings in the format produced by pg_size_pretty() and
> return sizes in bytes. This allows queries to be written with clauses
> like "pg_total_relation_size(oid) > pg_size_bytes('10 GB')".
>
> Author: Pavel Stehule with various improvements by Vitaly Burovoy
> Discussion: http://www.postgresql.org/message-id/CAFj8pRD-tGoDKnxdYgECzA4On01_uRqPrwF-8LdkSE-6bDHp0w@mail.gmail....
> Reviewed-by: Vitaly Burovoy, Oleksandr Shulgin, Kyotaro Horiguchi,
> Michael Paquier and Robert Haas
Happy first commit.
--
Michael
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.
2016-02-20 10:07 pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:12 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Michael Paquier <michael.paquier@gmail.com>
@ 2016-02-20 10:16 ` Michael Paquier <michael.paquier@gmail.com>
1 sibling, 0 replies; 9+ messages in thread
From: Michael Paquier @ 2016-02-20 10:16 UTC (permalink / raw)
To: Dean Rasheed <dean.a.rasheed@gmail.com>; +Cc: pgsql-committers
On Sat, Feb 20, 2016 at 7:12 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Sat, Feb 20, 2016 at 7:07 PM, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>> Add pg_size_bytes() to parse human-readable size strings.
>>
>> This will parse strings in the format produced by pg_size_pretty() and
>> return sizes in bytes. This allows queries to be written with clauses
>> like "pg_total_relation_size(oid) > pg_size_bytes('10 GB')".
>>
>> Author: Pavel Stehule with various improvements by Vitaly Burovoy
>> Discussion: http://www.postgresql.org/message-id/CAFj8pRD-tGoDKnxdYgECzA4On01_uRqPrwF-8LdkSE-6bDHp0w@mail.gmail....
>> Reviewed-by: Vitaly Burovoy, Oleksandr Shulgin, Kyotaro Horiguchi,
>> Michael Paquier and Robert Haas
>
> Happy first commit.
And happy first buildfarm breakage :)
http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=termite&dt=2016-02-20%2010%3A10%3A07
--
Michael
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.
2016-02-20 10:07 pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:12 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Michael Paquier <michael.paquier@gmail.com>
@ 2016-02-20 10:17 ` Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:32 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Vik Fearing <vik@2ndquadrant.fr>
2016-02-20 10:33 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Michael Paquier <michael.paquier@gmail.com>
1 sibling, 2 replies; 9+ messages in thread
From: Dean Rasheed @ 2016-02-20 10:17 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; +Cc: pgsql-committers
On 20 February 2016 at 10:12, Michael Paquier <michael.paquier@gmail.com> wrote:
> Happy first commit.
Arg. Not so much.
Looks like I broke something -- looking into it now :-(
Regards,
Dean
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.
2016-02-20 10:07 pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:12 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Michael Paquier <michael.paquier@gmail.com>
2016-02-20 10:17 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
@ 2016-02-20 10:32 ` Vik Fearing <vik@2ndquadrant.fr>
2016-02-20 16:31 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Joe Conway <mail@joeconway.com>
1 sibling, 1 reply; 9+ messages in thread
From: Vik Fearing @ 2016-02-20 10:32 UTC (permalink / raw)
To: Dean Rasheed <dean.a.rasheed@gmail.com>; Michael Paquier <michael.paquier@gmail.com>; +Cc: pgsql-committers
On 02/20/2016 11:17 AM, Dean Rasheed wrote:
> On 20 February 2016 at 10:12, Michael Paquier <michael.paquier@gmail.com> wrote:
>> Happy first commit.
>
> Arg. Not so much.
>
> Looks like I broke something -- looking into it now :-(
Happy first commit anyway!
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.
2016-02-20 10:07 pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:12 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Michael Paquier <michael.paquier@gmail.com>
2016-02-20 10:17 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:32 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Vik Fearing <vik@2ndquadrant.fr>
@ 2016-02-20 16:31 ` Joe Conway <mail@joeconway.com>
0 siblings, 0 replies; 9+ messages in thread
From: Joe Conway @ 2016-02-20 16:31 UTC (permalink / raw)
To: Vik Fearing <vik@2ndquadrant.fr>; Dean Rasheed <dean.a.rasheed@gmail.com>; Michael Paquier <michael.paquier@gmail.com>; +Cc: pgsql-committers
On 02/20/2016 02:32 AM, Vik Fearing wrote:
> On 02/20/2016 11:17 AM, Dean Rasheed wrote:
>> On 20 February 2016 at 10:12, Michael Paquier <michael.paquier@gmail.com> wrote:
>>> Happy first commit.
>>
>> Arg. Not so much.
>>
>> Looks like I broke something -- looking into it now :-(
>
> Happy first commit anyway!
>
+1
--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development
Attachments:
signature.asc (application/pgp-signature, 835B) download
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.
2016-02-20 10:07 pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:12 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Michael Paquier <michael.paquier@gmail.com>
2016-02-20 10:17 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
@ 2016-02-20 10:33 ` Michael Paquier <michael.paquier@gmail.com>
2016-02-20 10:48 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
1 sibling, 1 reply; 9+ messages in thread
From: Michael Paquier @ 2016-02-20 10:33 UTC (permalink / raw)
To: Dean Rasheed <dean.a.rasheed@gmail.com>; +Cc: pgsql-committers
On Sat, Feb 20, 2016 at 7:17 PM, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
> On 20 February 2016 at 10:12, Michael Paquier <michael.paquier@gmail.com> wrote:
>> Happy first commit.
>
> Arg. Not so much.
>
> Looks like I broke something -- looking into it now :-(
The terabyte conversion is at fault:
Expected:
! -1tb | -1099511627776
Result:
! -1tb | -1
+ else if (pg_strcasecmp(strptr, "gb") == 0)
+ multiplier = 1024 * 1024 * 1024;
+ else if (pg_strcasecmp(strptr, "tb") == 0)
+ multiplier = 1024 * 1024 * 1024 * 1024L;
Why adding an 'L' here?
--
Michael
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.
2016-02-20 10:07 pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:12 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Michael Paquier <michael.paquier@gmail.com>
2016-02-20 10:17 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:33 ` Re: pgsql: Add pg_size_bytes() to parse human-readable size strings. Michael Paquier <michael.paquier@gmail.com>
@ 2016-02-20 10:48 ` Dean Rasheed <dean.a.rasheed@gmail.com>
0 siblings, 0 replies; 9+ messages in thread
From: Dean Rasheed @ 2016-02-20 10:48 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; +Cc: pgsql-committers
On 20 February 2016 at 10:33, Michael Paquier <michael.paquier@gmail.com> wrote:
> On Sat, Feb 20, 2016 at 7:17 PM, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>> On 20 February 2016 at 10:12, Michael Paquier <michael.paquier@gmail.com> wrote:
>>> Happy first commit.
>>
>> Arg. Not so much.
>>
>> Looks like I broke something -- looking into it now :-(
>
> The terabyte conversion is at fault:
> Expected:
> ! -1tb | -1099511627776
> Result:
> ! -1tb | -1
>
> + else if (pg_strcasecmp(strptr, "gb") == 0)
> + multiplier = 1024 * 1024 * 1024;
> + else if (pg_strcasecmp(strptr, "tb") == 0)
> + multiplier = 1024 * 1024 * 1024 * 1024L;
> Why adding an 'L' here?
Ah, looks like it needs to be 'LL' because it needs to be a 64-bit literal.
Regards,
Dean
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.
2016-02-20 10:07 pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
@ 2016-02-20 14:04 ` Pavel Stehule <pavel.stehule@gmail.com>
1 sibling, 0 replies; 9+ messages in thread
From: Pavel Stehule @ 2016-02-20 14:04 UTC (permalink / raw)
To: Dean Rasheed <dean.a.rasheed@gmail.com>; +Cc: pgsql-committers
2016-02-20 11:07 GMT+01:00 Dean Rasheed <dean.a.rasheed@gmail.com>:
> Add pg_size_bytes() to parse human-readable size strings.
>
> This will parse strings in the format produced by pg_size_pretty() and
> return sizes in bytes. This allows queries to be written with clauses
> like "pg_total_relation_size(oid) > pg_size_bytes('10 GB')".
>
> Author: Pavel Stehule with various improvements by Vitaly Burovoy
> Discussion:
> http://www.postgresql.org/message-id/CAFj8pRD-tGoDKnxdYgECzA4On01_uRqPrwF-8LdkSE-6bDHp0w@mail.gmail....
> Reviewed-by: Vitaly Burovoy, Oleksandr Shulgin, Kyotaro Horiguchi,
> Michael Paquier and Robert Haas
>
> Branch
> ------
> master
>
> Details
> -------
>
> http://git.postgresql.org/pg/commitdiff/53874c5228fe16589a4d01b3e1fab3678e0fd8e3
>
> Modified Files
> --------------
> doc/src/sgml/func.sgml | 32 +++++++-
> src/backend/utils/adt/dbsize.c | 149
> +++++++++++++++++++++++++++++++++++
> src/include/catalog/catversion.h | 2 +-
> src/include/catalog/pg_proc.h | 2 +
> src/include/utils/builtins.h | 1 +
> src/test/regress/expected/dbsize.out | 109 +++++++++++++++++++++++++
> src/test/regress/sql/dbsize.sql | 39 +++++++++
> 7 files changed, 331 insertions(+), 3 deletions(-)
>
great :)
Thank you very much
Regards
Pavel
>
>
> --
> Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-committers
>
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2016-02-20 16:31 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-02-20 10:07 pgsql: Add pg_size_bytes() to parse human-readable size strings. Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:12 ` Michael Paquier <michael.paquier@gmail.com>
2016-02-20 10:16 ` Michael Paquier <michael.paquier@gmail.com>
2016-02-20 10:17 ` Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 10:32 ` Vik Fearing <vik@2ndquadrant.fr>
2016-02-20 16:31 ` Joe Conway <mail@joeconway.com>
2016-02-20 10:33 ` Michael Paquier <michael.paquier@gmail.com>
2016-02-20 10:48 ` Dean Rasheed <dean.a.rasheed@gmail.com>
2016-02-20 14:04 ` Pavel Stehule <pavel.stehule@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox