1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-09 22:41:56 +03:00
Files
postgres/src/backend
David Rowley 56ff8b2991 Use a lookup table for units in pg_size_pretty and pg_size_bytes
We've grown 2 versions of pg_size_pretty over the years, one for BIGINT
and one for NUMERIC.  Both should output the same, but keeping them in
sync is harder than needed due to neither function sharing a source of
truth about which units to use and how to transition to the next largest
unit.

Here we add a static array which defines the units that we recognize and
have both pg_size_pretty and pg_size_pretty_numeric use it.  This will
make adding any units in the future a very simple task.

The table contains all information required to allow us to also modify
pg_size_bytes to use the lookup table, so adjust that too.

There are no behavioral changes here.

Author: David Rowley
Reviewed-by: Dean Rasheed, Tom Lane, David Christensen
Discussion: https://postgr.es/m/CAApHDvru1F7qsEVL-iOHeezJ+5WVxXnyD_Jo9nht+Eh85ekK-Q@mail.gmail.com
2021-07-09 16:29:02 +12:00
..
2021-01-02 13:06:25 -05:00
2021-04-20 14:35:16 +02:00
2021-01-02 13:06:25 -05:00
2021-06-21 12:33:50 +02:00
2021-02-19 08:10:15 +01:00
2021-06-27 09:41:16 +02:00
2021-07-02 13:32:21 +12:00
2021-06-28 08:36:44 +02:00
2018-03-30 17:33:04 -07:00
2021-05-10 14:36:21 +02:00