Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-20 Thread Dean Rasheed
On 18 February 2016 at 10:05, Dean Rasheed wrote: > OK, I'll add a check for that. > Thanks for testing. > Pushed, with a catversion bump. Regards, Dean -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-18 Thread Dean Rasheed
On 18 February 2016 at 02:00, Vitaly Burovoy wrote: >> + else >> + have_digits = false; > Does it worth to move it to the declaration and remove that "else" block? > + boolhave_digits = false; OK, that's probably a bit neater. > Is it

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-17 Thread Vitaly Burovoy
On 2/17/16, Dean Rasheed wrote: > On 17 February 2016 at 00:39, Vitaly Burovoy > wrote: >> Now parse_memory_unit returns -1024 for bytes as divider, constant >> "bytes" has moved there. >> Add new memory_units_bytes_hint which differs from an

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-17 Thread Dean Rasheed
On 17 February 2016 at 00:39, Vitaly Burovoy wrote: > On 2/16/16, Vitaly Burovoy wrote: >> On 2/16/16, Dean Rasheed wrote: >>> Fixing that in parse_memory_unit() would be messy because it assumes a >>> base unit of

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-16 Thread Vitaly Burovoy
On 2/16/16, Vitaly Burovoy wrote: > On 2/16/16, Dean Rasheed wrote: >> Fixing that in parse_memory_unit() would be messy because it assumes a >> base unit of kB, so it would require a negative multiplier, and >> pg_size_bytes() would have to be

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-16 Thread Vitaly Burovoy
On 2/16/16, Vitaly Burovoy wrote: > On 2/16/16, Dean Rasheed wrote: >> On 16 February 2016 at 05:01, Pavel Stehule >> wrote: >>> 2016-02-15 10:16 GMT+01:00 Dean Rasheed : >> Fixing that in

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-16 Thread Vitaly Burovoy
On 2/16/16, Dean Rasheed wrote: > On 16 February 2016 at 05:01, Pavel Stehule > wrote: >> 2016-02-15 10:16 GMT+01:00 Dean Rasheed : >>> Is there any reason not to make >>> pg_size_bytes() return numeric? >>> >> This is

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-16 Thread Pavel Stehule
2016-02-16 11:25 GMT+01:00 Dean Rasheed : > On 16 February 2016 at 05:01, Pavel Stehule > wrote: > > 2016-02-15 10:16 GMT+01:00 Dean Rasheed : > >> Is there any reason not to make > >> pg_size_bytes() return numeric? >

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-16 Thread Dean Rasheed
On 16 February 2016 at 05:01, Pavel Stehule wrote: > 2016-02-15 10:16 GMT+01:00 Dean Rasheed : >> Is there any reason not to make >> pg_size_bytes() return numeric? >> > This is a question. I have not a strong opinion about it. There are no any >

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-15 Thread Pavel Stehule
Hi 2016-02-15 10:16 GMT+01:00 Dean Rasheed : > > On 12/02/16 10:19, Dean Rasheed wrote: > >> This seems like a reasonable first patch for me as a committer, so > >> I'll take it unless anyone else was planning to do so. > > > > So looking at this, it seems that for the

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-15 Thread Vitaly Burovoy
On 2/15/16, Vitaly Burovoy wrote: > P.S.: "bytes" size unit was added just for consistency: each group > should have a name, even with an exponent of 1. Oops... Of course, "even with an exponent of 0". -- Best regards, Vitaly Burovoy -- Sent via pgsql-hackers

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-15 Thread Vitaly Burovoy
On 2/15/16, Dean Rasheed wrote: >> On 12/02/16 10:19, Dean Rasheed wrote: >>> This seems like a reasonable first patch for me as a committer, so >>> I'll take it unless anyone else was planning to do so. >> > > So looking at this, it seems that for the most part

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-15 Thread Dean Rasheed
> On 12/02/16 10:19, Dean Rasheed wrote: >> This seems like a reasonable first patch for me as a committer, so >> I'll take it unless anyone else was planning to do so. > So looking at this, it seems that for the most part pg_size_bytes() will parse any output produced by pg_size_pretty(). The

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-12 Thread Heikki Linnakangas
On 12/02/16 10:19, Dean Rasheed wrote: On 12 February 2016 at 06:25, Pavel Stehule wrote: Thank you for review and other work This seems like a reasonable first patch for me as a committer, so I'll take it unless anyone else was planning to do so. Great! You'll

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-12 Thread Dean Rasheed
On 12 February 2016 at 06:25, Pavel Stehule wrote: > Thank you for review and other work > This seems like a reasonable first patch for me as a committer, so I'll take it unless anyone else was planning to do so. Regards, Dean -- Sent via pgsql-hackers mailing list

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-11 Thread Pavel Stehule
Hi assigned https://commitfest.postgresql.org/9/514/ Regards Pavel

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-11 Thread Pavel Stehule
2016-02-11 7:44 GMT+01:00 Vitaly Burovoy : > On 2/10/16, Pavel Stehule wrote: > > Hi Vitaly, > > > > please, can you send your version of this patch, how we talked about it > in > > Moscow? > > > > Thank you > > > > Pavel > > Hello, Pavel! > >

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-11 Thread Pavel Stehule
This is last incarnation of my patch (cleaned and refactored by Vitaly Burovoy) -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-11 Thread Pavel Stehule
Hi 2016-02-12 2:28 GMT+01:00 Vitaly Burovoy : > Hello! > > On 2/11/16, Pavel Stehule wrote: > > Hi > > > > assigned https://commitfest.postgresql.org/9/514/ > > > > Regards > > Pavel > > > This patch was almost done by the end of the previous

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-11 Thread Pavel Stehule
Hi 2016-02-11 7:44 GMT+01:00 Vitaly Burovoy : > On 2/10/16, Pavel Stehule wrote: > > Hi Vitaly, > > > > please, can you send your version of this patch, how we talked about it > in > > Moscow? > > > > Thank you > > > > Pavel > > Hello, Pavel! >

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-11 Thread Vitaly Burovoy
Hello! On 2/11/16, Pavel Stehule wrote: > Hi > > assigned https://commitfest.postgresql.org/9/514/ > > Regards > Pavel This patch was almost done by the end of the previous CF(2016-01): there was few little flaws which are solved by now. I have reviewed this patch. It

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-10 Thread Pavel Stehule
Hi Vitaly, please, can you send your version of this patch, how we talked about it in Moscow? Thank you Pavel

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-02-10 Thread Vitaly Burovoy
On 2/10/16, Pavel Stehule wrote: > Hi Vitaly, > > please, can you send your version of this patch, how we talked about it in > Moscow? > > Thank you > > Pavel Hello, Pavel! Please find attached my version of the patch (it applies cleanly on top of 64d89a9 which is

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-31 Thread Tom Lane
Vitaly Burovoy writes: > On 1/30/16, Pavel Stehule wrote: >> I though about it, but it is not possible. Every PG_TRY/CATCH must be >> finished by RETHROW. > No, src/include/utils/elog.h tells different (emphasizes are mine): > "The error

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-30 Thread Vitaly Burovoy
Hello,Pavel! On 1/26/16, Pavel Stehule wrote: > I am grateful for review - now this patch is better, and I hope near final > stage. > > Regards > Pavel I'm pretty sure we are close to it. Now besides a code design I mentioned[1] before (and no one has answered me about

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-30 Thread Pavel Stehule
Hi > P.S.: Have you thought to wrap the call "numeric_in" by a > PG_TRY/PG_CATCH instead of checking for correctness by yourself? > I though about it, but it is not possible. Every PG_TRY/CATCH must be finished by RETHROW. Only when you will open subtransaction and you are playing with resource

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-30 Thread Vitaly Burovoy
On 1/30/16, Pavel Stehule wrote: >> P.S.: Have you thought to wrap the call "numeric_in" by a >> PG_TRY/PG_CATCH instead of checking for correctness by yourself? > > I though about it, but it is not possible. Every PG_TRY/CATCH must be > finished by RETHROW. No,

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-26 Thread Pavel Stehule
Hi 2016-01-26 13:48 GMT+01:00 Vitaly Burovoy : > Hello, Pavel! > > That letter was not a complain against you. I'm sorry if it seems like > that for you. > ok. It was an intermediate review with several points to be clear for _me_ > from experienced hackers, mostly

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-26 Thread Vitaly Burovoy
Hello, Pavel! That letter was not a complain against you. I'm sorry if it seems like that for you. It was an intermediate review with several points to be clear for _me_ from experienced hackers, mostly about a code design. 26.01.2016 07:05, Pavel Stehule пишет: >> pg_proc.h has changed, so the

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-25 Thread Vitaly Burovoy
Hello! I have reviewed this patch. It applies and compiles cleanly at the current master 1129c2b0ad2732f301f696ae2cf98fb063a4c1f8 and implements the behavior reached by a consensus. All size units (the same as used in the GUC) are supported. The documentation is present and describes behavior

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-25 Thread Pavel Stehule
Hi 2016-01-26 6:25 GMT+01:00 Vitaly Burovoy : > Hello! > > > Regression tests are present (see p.II). > > pg_proc.h has changed, so the CATALOG_VERSION_NO must be also changed. > this is not a part of patch - only a commiter knows CATALOG_VERSION_NO > > Code

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-25 Thread Pavel Stehule
Hi 2016-01-22 7:03 GMT+01:00 Vitaly Burovoy : > On 1/20/16, Pavel Stehule wrote: > > ... > > New version is attached > > > > Regards > > Pavel > > Hello! > > 1. Why the function is marked as VOLATILE? It depends only on input > value, it does

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-21 Thread Vitaly Burovoy
On 1/20/16, Pavel Stehule wrote: > ... > New version is attached > > Regards > Pavel I'm sorry I'll do a review only tonight. -- Best regards, Vitaly Burovoy -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-21 Thread Pavel Stehule
2016-01-21 11:51 GMT+01:00 Vitaly Burovoy : > On 1/20/16, Pavel Stehule wrote: > > ... > > New version is attached > > > > Regards > > Pavel > > I'm sorry I'll do a review only tonight. > ook :) Thank you Pavel > -- > Best regards, >

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-21 Thread Pavel Stehule
2016-01-22 7:03 GMT+01:00 Vitaly Burovoy : > On 1/20/16, Pavel Stehule wrote: > > ... > > New version is attached > > > > Regards > > Pavel > > Hello! > > 1. Why the function is marked as VOLATILE? It depends only on input > value, it does

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-21 Thread Vitaly Burovoy
On 1/20/16, Pavel Stehule wrote: > ... > New version is attached > > Regards > Pavel Hello! 1. Why the function is marked as VOLATILE? It depends only on input value, it does change nothing in the DB. I guess it should be IMMUTABLE for efficient caching its result. 2.

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-20 Thread Pavel Stehule
2016-01-19 4:45 GMT+01:00 Vitaly Burovoy : > On 1/4/16, Pavel Stehule wrote: > > 2016-01-04 18:13 GMT+01:00 Shulgin, Oleksandr < > oleksandr.shul...@zalando.de> : > >> On Mon, Jan 4, 2016 at 6:03 PM, Pavel Stehule >

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-20 Thread Pavel Stehule
Hi 2016-01-19 0:56 GMT+01:00 Vitaly Burovoy : > On 1/4/16, Robert Haas wrote: > > On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule > > wrote: > >> [ new patch ] > > > > + case '-': > > + ereport(ERROR,

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-19 Thread Robert Haas
On Mon, Jan 18, 2016 at 6:56 PM, Vitaly Burovoy wrote: > On 1/4/16, Robert Haas wrote: >> On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule >> wrote: >>> [ new patch ] >> >> + case '-': >> +

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-19 Thread Pavel Stehule
2016-01-19 13:42 GMT+01:00 Robert Haas : > On Mon, Jan 18, 2016 at 6:56 PM, Vitaly Burovoy > wrote: > > On 1/4/16, Robert Haas wrote: > >> On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule > > >>

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-18 Thread Vitaly Burovoy
On 1/4/16, Robert Haas wrote: > On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule > wrote: >> [ new patch ] > > + case '-': > + ereport(ERROR, > + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), > +

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-18 Thread Vitaly Burovoy
On 1/4/16, Pavel Stehule wrote: > 2016-01-04 18:13 GMT+01:00 Shulgin, Oleksandr : >> On Mon, Jan 4, 2016 at 6:03 PM, Pavel Stehule >> wrote: >> > 2016-01-04 17:48 GMT+01:00 Shulgin, Oleksandr >> >

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-18 Thread Vitaly Burovoy
On 1/18/16, Vitaly Burovoy wrote: > <> > --- > + if (*strptr != '\0') > ... > + while (*strptr && !isspace(*strptr)) > Sometimes it explicitly compares to '\0', sometimes implicitly. > Common use is explicit comparison and it is preferred due to different

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Alvaro Herrera
Robert Haas wrote: > But you could also write SELECT relname FROM pg_class WHERE > pg_relation_size(oid) > 100 * 1024^3, which is actually fewer > characters. Maybe pg_size_bytes('100 GB') is easier for some people > to remember than 100 * 1024^3, but I'm probably not one of those > people.

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Pavel Stehule
2016-01-04 21:29 GMT+01:00 Robert Haas : > On Mon, Jan 4, 2016 at 12:17 PM, Shulgin, Oleksandr > wrote: > >> 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

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Robert Haas
On Mon, Jan 4, 2016 at 3:48 PM, Alvaro Herrera wrote: > Robert Haas wrote: > >> But you could also write SELECT relname FROM pg_class WHERE >> pg_relation_size(oid) > 100 * 1024^3, which is actually fewer >> characters. Maybe pg_size_bytes('100 GB') is easier for some

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Robert Haas
On Mon, Jan 4, 2016 at 12:17 PM, Shulgin, Oleksandr wrote: >> 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

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Shulgin, Oleksandr
On Wed, Dec 30, 2015 at 8:28 PM, Pavel Stehule wrote: > > > 2015-12-30 17:33 GMT+01:00 Robert Haas : > >> On Mon, Dec 28, 2015 at 8:45 AM, Shulgin, Oleksandr >> wrote: >> > I didn't check out earlier versions of this

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Pavel Stehule
Hi 2016-01-04 12:46 GMT+01:00 Shulgin, Oleksandr : > On Wed, Dec 30, 2015 at 8:28 PM, Pavel Stehule > wrote: > >> >> >> 2015-12-30 17:33 GMT+01:00 Robert Haas : >> >>> On Mon, Dec 28, 2015 at 8:45 AM, Shulgin,

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Robert Haas
On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule wrote: > [ new patch ] + case '-': + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("size cannot be negative"))); Why not? I bet if you

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Pavel Stehule
2016-01-04 16:51 GMT+01:00 Robert Haas : > On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule > wrote: > > [ new patch ] > > + case '-': > + ereport(ERROR, > + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), > +

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Shulgin, Oleksandr
On Mon, Jan 4, 2016 at 6:03 PM, Pavel Stehule wrote: > > 2016-01-04 17:48 GMT+01:00 Shulgin, Oleksandr < oleksandr.shul...@zalando.de>: >> >> On Mon, Jan 4, 2016 at 4:51 PM, Robert Haas wrote: >>> >>> On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Robert Haas
On Mon, Jan 4, 2016 at 11:48 AM, Shulgin, Oleksandr wrote: > On Mon, Jan 4, 2016 at 4:51 PM, Robert Haas wrote: >> >> On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule >> wrote: >> > [ new patch ] >> >> + case

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Shulgin, Oleksandr
On Mon, Jan 4, 2016 at 6:14 PM, Robert Haas 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 >

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Pavel Stehule
2016-01-04 18:14 GMT+01:00 Robert Haas : > On Mon, Jan 4, 2016 at 11:48 AM, Shulgin, Oleksandr > wrote: > > On Mon, Jan 4, 2016 at 4:51 PM, Robert Haas > wrote: > >> > >> On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Pavel Stehule
2016-01-04 18:13 GMT+01:00 Shulgin, Oleksandr : > On Mon, Jan 4, 2016 at 6:03 PM, Pavel Stehule > wrote: > > > > 2016-01-04 17:48 GMT+01:00 Shulgin, Oleksandr < > oleksandr.shul...@zalando.de>: > >> > >> On Mon, Jan 4, 2016 at 4:51 PM,

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Thom Brown
On 4 January 2016 at 15:17, Pavel Stehule wrote: > Hi > > 2016-01-04 12:46 GMT+01:00 Shulgin, Oleksandr > : >> >> On Wed, Dec 30, 2015 at 8:28 PM, Pavel Stehule >> wrote: >>> >>> >>> >>> 2015-12-30 17:33 GMT+01:00

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Shulgin, Oleksandr
On Mon, Jan 4, 2016 at 4:51 PM, Robert Haas wrote: > On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule > wrote: > > [ new patch ] > > + case '-': > + ereport(ERROR, > +

Re: [HACKERS] custom function for converting human readable sizes to bytes

2016-01-04 Thread Pavel Stehule
2016-01-04 17:48 GMT+01:00 Shulgin, Oleksandr : > On Mon, Jan 4, 2016 at 4:51 PM, Robert Haas wrote: > >> On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule >> wrote: >> > [ new patch ] >> >> + case '-': >> +

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-30 Thread Robert Haas
On Mon, Dec 28, 2015 at 8:45 AM, Shulgin, Oleksandr wrote: > I didn't check out earlier versions of this patch, but the latest one still > changes pg_size_pretty() to emit PB suffix. > > I don't think it is worth it to throw a number of changes together like > that.

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-30 Thread Pavel Stehule
2015-12-30 17:33 GMT+01:00 Robert Haas : > On Mon, Dec 28, 2015 at 8:45 AM, Shulgin, Oleksandr > wrote: > > I didn't check out earlier versions of this patch, but the latest one > still > > changes pg_size_pretty() to emit PB suffix. > > > > I

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-30 Thread Shulgin, Oleksandr
On Tue, Dec 29, 2015 at 7:15 PM, Pavel Stehule wrote: > >> I didn't check out earlier versions of this patch, but the latest one >> still changes pg_size_pretty() to emit PB suffix. >> >> I don't think it is worth it to throw a number of changes together like >> that.

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-29 Thread Pavel Stehule
Hi >>> -1 from me. I don't think we should muck with the way pg_size_pretty >>> works. >>> >> >> new update - I reverted changes in pg_size_pretty >> > > Hi, > > I didn't check out earlier versions of this patch, but the latest one > still changes pg_size_pretty() to emit PB suffix. > > I don't

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-28 Thread Shulgin, Oleksandr
On Tue, Dec 22, 2015 at 10:45 AM, Pavel Stehule wrote: > Hi > > 2015-12-21 16:11 GMT+01:00 Robert Haas : > >> On Sun, Dec 20, 2015 at 4:54 AM, Pavel Stehule >> wrote: >> > new update: >> > >> > 1. unit searching is case

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-22 Thread Pavel Stehule
Hi 2015-12-21 16:11 GMT+01:00 Robert Haas : > On Sun, Dec 20, 2015 at 4:54 AM, Pavel Stehule > wrote: > > new update: > > > > 1. unit searching is case insensitive > > > > 2. initial support for binary byte prefixes - KiB, MiB, .. (IEC >

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-21 Thread Michael Paquier
On Tue, Dec 22, 2015 at 12:11 AM, Robert Haas wrote: > On Sun, Dec 20, 2015 at 4:54 AM, Pavel Stehule > wrote: >> new update: >> >> 1. unit searching is case insensitive >> >> 2. initial support for binary byte prefixes - KiB, MiB, .. (IEC

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-21 Thread Pavel Stehule
2015-12-22 6:57 GMT+01:00 Michael Paquier : > On Tue, Dec 22, 2015 at 2:33 PM, Pavel Stehule > wrote: > > > > > > 2015-12-22 6:22 GMT+01:00 Michael Paquier : > >> > >> On Tue, Dec 22, 2015 at 12:11 AM, Robert Haas

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-21 Thread Pavel Stehule
2015-12-22 6:22 GMT+01:00 Michael Paquier : > On Tue, Dec 22, 2015 at 12:11 AM, Robert Haas > wrote: > > On Sun, Dec 20, 2015 at 4:54 AM, Pavel Stehule > wrote: > >> new update: > >> > >> 1. unit searching is case

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-21 Thread Michael Paquier
On Tue, Dec 22, 2015 at 2:33 PM, Pavel Stehule wrote: > > > 2015-12-22 6:22 GMT+01:00 Michael Paquier : >> >> On Tue, Dec 22, 2015 at 12:11 AM, Robert Haas >> wrote: >> > On Sun, Dec 20, 2015 at 4:54 AM, Pavel Stehule

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-21 Thread Robert Haas
On Sun, Dec 20, 2015 at 4:54 AM, Pavel Stehule wrote: > new update: > > 1. unit searching is case insensitive > > 2. initial support for binary byte prefixes - KiB, MiB, .. (IEC standard), > change behave for SI units > > Second point is much more complex then it is

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-20 Thread Pavel Stehule
Hi new update: 1. unit searching is case insensitive 2. initial support for binary byte prefixes - KiB, MiB, .. (IEC standard), change behave for SI units Second point is much more complex then it is looking - if pg_size_bytes should be consistent with pg_size_pretty. The current

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-01 Thread Kyotaro HORIGUCHI
Hello, The meaning of "be orange" (I couldn't find it) interests me but putting it aside.. I have some random comments. At Mon, 30 Nov 2015 18:30:18 +0100, Pavel Stehule wrote in > Hi > > > > 2.

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-01 Thread Pavel Stehule
2015-12-01 11:02 GMT+01:00 Kyotaro HORIGUCHI < horiguchi.kyot...@lab.ntt.co.jp>: > Hello, The meaning of "be orange" (I couldn't find it) interests > me but putting it aside.. > > I have some random comments. > > At Mon, 30 Nov 2015 18:30:18 +0100, Pavel Stehule > wrote

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-12-01 Thread Pavel Stehule
2015-12-01 11:12 GMT+01:00 Pavel Stehule : > > > 2015-12-01 11:02 GMT+01:00 Kyotaro HORIGUCHI < > horiguchi.kyot...@lab.ntt.co.jp>: > >> Hello, The meaning of "be orange" (I couldn't find it) interests >> me but putting it aside.. >> >> I have some random comments. >> >>

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-30 Thread Pavel Stehule
Hi > 2. using independent implementation - there is some redundant code, but we > can support duble insted int, and we can support some additional units. > new patch is based on own implementation - use numeric/bigint calculations + regress tests and doc Regards Pavel diff --git

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-25 Thread Kevin Grittner
On Wed, Nov 25, 2015 at 12:57 AM, Jim Nasby wrote: > Should read " isn't a valid size value" http://www.postgresql.org/docs/devel/static/error-style-guide.html#AEN110918 | Contractions. Avoid contractions, like "can't"; use "cannot" instead. So " is not a valid size

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-24 Thread Pavel Stehule
Hi 2015-11-23 19:47 GMT+01:00 Alvaro Herrera : > Pavel Stehule wrote: > > > so pg_size_bytes is good enough for everybody? > > That seems good enough to me. > > I would have it accept GiB and GB and have both transform to base 2, and > have an optional boolean flag

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-24 Thread Jim Nasby
On 11/24/15 10:57 PM, Pavel Stehule wrote: +errmsg("parameter \"%s\" isn't valid size value", Should read " isn't a valid size value" -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble?

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-23 Thread Gavin Flower
On 24/11/15 06:31, Pavel Stehule wrote: 2015-11-23 18:04 GMT+01:00 Tom Lane >: Jim Nasby writes: > On 11/23/15 3:11 AM, Corey Huinker wrote: >> +1 to both pg_size_bytes() and ::bytesize. Both contribute to

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-23 Thread Corey Huinker
On Sun, Nov 22, 2015 at 11:24 PM, Pavel Stehule wrote: > > > 2015-11-22 23:54 GMT+01:00 Corey Huinker : > >> What about pg_size_unpretty()? >>> >> I was going to suggest pg_size_ugly(), but unpretty does emphasize the >> inverse (rather than

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-23 Thread Robert Haas
On Mon, Nov 23, 2015 at 1:47 PM, Alvaro Herrera wrote: > Pavel Stehule wrote: > >> so pg_size_bytes is good enough for everybody? > > That seems good enough to me. > > I would have it accept GiB and GB and have both transform to base 2, and > have an optional boolean

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-23 Thread Tom Lane
Jim Nasby writes: > On 11/23/15 3:11 AM, Corey Huinker wrote: >> +1 to both pg_size_bytes() and ::bytesize. Both contribute to making the >> statements more self-documenting. > The function seems like overkill to me if we have the type. Just my > opinion though. I'm

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-23 Thread Alvaro Herrera
Pavel Stehule wrote: > so pg_size_bytes is good enough for everybody? That seems good enough to me. I would have it accept GiB and GB and have both transform to base 2, and have an optional boolean flag whose non-default value turns the GB interpretation into base 10, leaving the GiB

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-23 Thread Jim Nasby
On 11/23/15 3:11 AM, Corey Huinker wrote: +1 to both pg_size_bytes() and ::bytesize. Both contribute to making the statements more self-documenting. The function seems like overkill to me if we have the type. Just my opinion though. I'm thinking the type could just be called 'size' too (or

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-23 Thread Pavel Stehule
2015-11-23 18:04 GMT+01:00 Tom Lane : > Jim Nasby writes: > > On 11/23/15 3:11 AM, Corey Huinker wrote: > >> +1 to both pg_size_bytes() and ::bytesize. Both contribute to making the > >> statements more self-documenting. > > > The function seems like

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-22 Thread Corey Huinker
> > What about pg_size_unpretty()? > I was going to suggest pg_size_ugly(), but unpretty does emphasize the inverse (rather than opposite) nature of the function.

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-22 Thread Guillaume Lelarge
Le 22 nov. 2015 21:29, "Pavel Stehule" a écrit : > > > > 2015-11-22 21:19 GMT+01:00 Jim Nasby : >> >> On 11/22/15 2:11 PM, Pavel Stehule wrote: >>> >>> What about pg_size(text), pg_size(value bigint, unit text) ? >> >> >> I like, though I'd make

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-22 Thread Pavel Stehule
2015-11-22 23:54 GMT+01:00 Corey Huinker : > What about pg_size_unpretty()? >> > I was going to suggest pg_size_ugly(), but unpretty does emphasize the > inverse (rather than opposite) nature of the function. > "unpretty", "ugly" aren't good names maybe pg_size_bytes or

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-22 Thread Pavel Stehule
2015-11-22 18:30 GMT+01:00 Jim Nasby : > On 11/21/15 12:49 AM, Pavel Stehule wrote: > >> >> I propose inversion function to pg_size_pretty function - like >> pg_human_size. >> >> Usage: >> >> SELECT * FROM pg_class >>WHERE pg_table_size(oid) > pg_human_size('2GB');

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-22 Thread Marko Tiikkaja
On 2015-11-22 18:30, Jim Nasby wrote: On 11/21/15 12:49 AM, Pavel Stehule wrote: I propose inversion function to pg_size_pretty function - like pg_human_size. Usage: SELECT * FROM pg_class WHERE pg_table_size(oid) > pg_human_size('2GB'); I'm not a big fan of the name, but +1 on the

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-22 Thread Jim Nasby
On 11/22/15 2:11 PM, Pavel Stehule wrote: What about pg_size(text), pg_size(value bigint, unit text) ? I like, though I'd make it numeric or float. pg_size(3.5, 'GB') certainly seems like a reasonable use case... -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-22 Thread Pavel Stehule
2015-11-22 21:19 GMT+01:00 Jim Nasby : > On 11/22/15 2:11 PM, Pavel Stehule wrote: > >> What about pg_size(text), pg_size(value bigint, unit text) ? >> > > I like, though I'd make it numeric or float. pg_size(3.5, 'GB') certainly > seems like a reasonable use case...

Re: [HACKERS] custom function for converting human readable sizes to bytes

2015-11-22 Thread Jim Nasby
On 11/21/15 12:49 AM, Pavel Stehule wrote: I propose inversion function to pg_size_pretty function - like pg_human_size. Usage: SELECT * FROM pg_class WHERE pg_table_size(oid) > pg_human_size('2GB'); I'm not a big fan of the name, but +1 on the general idea. Maybe pg_size_pretty(text)?

[HACKERS] custom function for converting human readable sizes to bytes

2015-11-20 Thread Pavel Stehule
Hi I have to write some filters, and filtering by size is "unfriendly" due calculation in bytes. I propose inversion function to pg_size_pretty function - like pg_human_size. Usage: SELECT * FROM pg_class WHERE pg_table_size(oid) > pg_human_size('2GB'); Ideas, comments? Regards Pavel