Re: [COMMITTERS] pgsql: Add pg_size_bytes() to parse human-readable size strings.
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>> 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 signature.asc Description: OpenPGP digital signature
Re: [COMMITTERS] pgsql: Add pg_size_bytes() to parse human-readable size strings.
2016-02-20 11:07 GMT+01:00 Dean Rasheed: > 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-6bdh...@mail.gmail.com > 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 >
Re: [COMMITTERS] pgsql: Add pg_size_bytes() to parse human-readable size strings.
On 20 February 2016 at 10:33, Michael Paquierwrote: > On Sat, Feb 20, 2016 at 7:17 PM, Dean Rasheed > wrote: >> On 20 February 2016 at 10:12, Michael Paquier >> 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
Re: [COMMITTERS] pgsql: Add pg_size_bytes() to parse human-readable size strings.
On Sat, Feb 20, 2016 at 7:17 PM, Dean Rasheedwrote: > On 20 February 2016 at 10:12, Michael Paquier > 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
Re: [COMMITTERS] pgsql: Add pg_size_bytes() to parse human-readable size strings.
On 02/20/2016 11:17 AM, Dean Rasheed wrote: > On 20 February 2016 at 10:12, Michael Paquier> 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
Re: [COMMITTERS] pgsql: Add pg_size_bytes() to parse human-readable size strings.
On 20 February 2016 at 10:12, Michael Paquierwrote: > 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
Re: [COMMITTERS] pgsql: Add pg_size_bytes() to parse human-readable size strings.
On Sat, Feb 20, 2016 at 7:12 PM, Michael Paquierwrote: > On Sat, Feb 20, 2016 at 7:07 PM, Dean Rasheed > 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-6bdh...@mail.gmail.com >> 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=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
Re: [COMMITTERS] pgsql: Add pg_size_bytes() to parse human-readable size strings.
On Sat, Feb 20, 2016 at 7:07 PM, Dean Rasheedwrote: > 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-6bdh...@mail.gmail.com > 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
[COMMITTERS] pgsql: Add pg_size_bytes() to parse human-readable size strings.
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-6bdh...@mail.gmail.com 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