forked from postgres/postgres
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pg_size_pretty: Format negative values similar to positive ones.
Previously, negative values were always displayed in bytes, regardless of how large they were. Adrian Vondendriesch, reviewed by Julien Rouhaud and myself
- Loading branch information
1 parent
dde5f09
commit 8a1fab3
Showing
5 changed files
with
89 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
SELECT size, pg_size_pretty(size), pg_size_pretty(-1 * size) FROM | ||
(VALUES (10::bigint), (1000::bigint), (1000000::bigint), | ||
(1000000000::bigint), (1000000000000::bigint), | ||
(1000000000000000::bigint)) x(size); | ||
size | pg_size_pretty | pg_size_pretty | ||
------------------+----------------+---------------- | ||
10 | 10 bytes | -10 bytes | ||
1000 | 1000 bytes | -1000 bytes | ||
1000000 | 977 kB | -977 kB | ||
1000000000 | 954 MB | -954 MB | ||
1000000000000 | 931 GB | -931 GB | ||
1000000000000000 | 909 TB | -909 TB | ||
(6 rows) | ||
|
||
SELECT size, pg_size_pretty(size), pg_size_pretty(-1 * size) FROM | ||
(VALUES (10::numeric), (1000::numeric), (1000000::numeric), | ||
(1000000000::numeric), (1000000000000::numeric), | ||
(1000000000000000::numeric), | ||
(10.5::numeric), (1000.5::numeric), (1000000.5::numeric), | ||
(1000000000.5::numeric), (1000000000000.5::numeric), | ||
(1000000000000000.5::numeric)) x(size); | ||
size | pg_size_pretty | pg_size_pretty | ||
--------------------+----------------+---------------- | ||
10 | 10 bytes | -10 bytes | ||
1000 | 1000 bytes | -1000 bytes | ||
1000000 | 977 kB | -977 kB | ||
1000000000 | 954 MB | -954 MB | ||
1000000000000 | 931 GB | -931 GB | ||
1000000000000000 | 909 TB | -909 TB | ||
10.5 | 10.5 bytes | -10.5 bytes | ||
1000.5 | 1000.5 bytes | -1000.5 bytes | ||
1000000.5 | 977 kB | -977 kB | ||
1000000000.5 | 954 MB | -954 MB | ||
1000000000000.5 | 931 GB | -931 GB | ||
1000000000000000.5 | 909 TB | -909 TB | ||
(12 rows) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
SELECT size, pg_size_pretty(size), pg_size_pretty(-1 * size) FROM | ||
(VALUES (10::bigint), (1000::bigint), (1000000::bigint), | ||
(1000000000::bigint), (1000000000000::bigint), | ||
(1000000000000000::bigint)) x(size); | ||
|
||
SELECT size, pg_size_pretty(size), pg_size_pretty(-1 * size) FROM | ||
(VALUES (10::numeric), (1000::numeric), (1000000::numeric), | ||
(1000000000::numeric), (1000000000000::numeric), | ||
(1000000000000000::numeric), | ||
(10.5::numeric), (1000.5::numeric), (1000000.5::numeric), | ||
(1000000000.5::numeric), (1000000000000.5::numeric), | ||
(1000000000000000.5::numeric)) x(size); |