Re: Add support for unit "B" to pg_size_pretty()

2023-03-07 Thread David Rowley
On Wed, 8 Mar 2023 at 09:22, Peter Eisentraut wrote: > Ok, I have fixed the original documentation to that effect and > backpatched it. Thanks for fixing that. David

Re: Add support for unit "B" to pg_size_pretty()

2023-03-07 Thread Peter Eisentraut
On 06.03.23 09:27, David Rowley wrote: On Mon, 6 Mar 2023 at 21:13, Peter Eisentraut wrote: On 02.03.23 20:58, David Rowley wrote: I think I'd prefer to see the size_bytes_unit_alias struct have an index into size_pretty_units[] array. i.e: Ok, done that way. (I had thought about that,

Re: Add support for unit "B" to pg_size_pretty()

2023-03-06 Thread David Rowley
On Mon, 6 Mar 2023 at 21:13, Peter Eisentraut wrote: > > On 02.03.23 20:58, David Rowley wrote: > > I think I'd prefer to see the size_bytes_unit_alias struct have an > > index into size_pretty_units[] array. i.e: > > Ok, done that way. (I had thought about that, but I was worried that > that

Re: Add support for unit "B" to pg_size_pretty()

2023-03-06 Thread Peter Eisentraut
On 02.03.23 20:58, David Rowley wrote: On Mon, 27 Feb 2023 at 21:34, Peter Eisentraut wrote: On 22.02.23 03:39, David Rowley wrote: I think you'll need to find another way to make the aliases work. Maybe another array with the name and an int to reference the corresponding index in

Re: Add support for unit "B" to pg_size_pretty()

2023-03-03 Thread Dean Rasheed
On Fri, 3 Mar 2023 at 11:23, David Rowley wrote: > > On Fri, 3 Mar 2023 at 09:32, Dean Rasheed wrote: > > Hmm, I think it would be easier to just have a separate table for > > pg_size_bytes(), rather than reusing pg_size_pretty()'s table. > > Maybe that's worthwhile if we were actually thinking

Re: Add support for unit "B" to pg_size_pretty()

2023-03-03 Thread David Rowley
On Fri, 3 Mar 2023 at 09:32, Dean Rasheed wrote: > Hmm, I think it would be easier to just have a separate table for > pg_size_bytes(), rather than reusing pg_size_pretty()'s table. I.e., > size_bytes_units[], which would only need name and multiplier columns > (not round and limit). Done that

Re: Add support for unit "B" to pg_size_pretty()

2023-03-02 Thread Dean Rasheed
On Thu, 2 Mar 2023 at 19:58, David Rowley wrote: > > I think I'd prefer to see the size_bytes_unit_alias struct have an > index into size_pretty_units[] array. i.e: > > struct size_bytes_unit_alias > { > const char *alias; /* aliased unit name */ > const int unit_index; /* corresponding

Re: Add support for unit "B" to pg_size_pretty()

2023-03-02 Thread David Rowley
On Mon, 27 Feb 2023 at 21:34, Peter Eisentraut wrote: > > On 22.02.23 03:39, David Rowley wrote: > > I think you'll need to find another way to make the aliases work. > > Maybe another array with the name and an int to reference the > > corresponding index in size_pretty_units. > > Ok, here is a

Re: Add support for unit "B" to pg_size_pretty()

2023-02-27 Thread Peter Eisentraut
On 22.02.23 03:39, David Rowley wrote: hmm. I didn't really code pg_size_pretty with aliases in mind. I don't think you can do this. There's code in pg_size_pretty() and pg_size_pretty_numeric() that'll not work correctly. We look ahead to the next unit to check if there is one so we know we

Re: Add support for unit "B" to pg_size_pretty()

2023-02-21 Thread David Rowley
On Wed, 22 Feb 2023 at 12:47, Peter Eisentraut wrote: > >> diff --git a/src/backend/utils/adt/dbsize.c > >> b/src/backend/utils/adt/dbsize.c > >> index dbd404101f..9ecd5428c3 100644 > >> --- a/src/backend/utils/adt/dbsize.c > >> +++ b/src/backend/utils/adt/dbsize.c > >> @@ -49,6 +49,7 @@ struct

Re: Add support for unit "B" to pg_size_pretty()

2023-02-21 Thread Peter Eisentraut
On 20.02.23 15:34, Justin Pryzby wrote: On Mon, Feb 20, 2023 at 07:44:15AM +0100, Peter Eisentraut wrote: This patch adds support for the unit "B" to pg_size_pretty(). This makes it It seems like what it actually does is to support "B" in pg_size_bytes() - is that what you meant ? yes

Re: Add support for unit "B" to pg_size_pretty()

2023-02-20 Thread Justin Pryzby
On Mon, Feb 20, 2023 at 07:44:15AM +0100, Peter Eisentraut wrote: > This patch adds support for the unit "B" to pg_size_pretty(). This makes it It seems like what it actually does is to support "B" in pg_size_bytes() - is that what you meant ? pg_size_pretty() already supports "bytes", so this