1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Ensure that btree sort ordering functions and boolean comparison operators

give consistent results for all datatypes.  Types float4, float8, and
numeric were broken for NaN values; abstime, timestamp, and interval
were broken for INVALID values; timetz was just plain broken (some
possible pairs of values were neither < nor = nor >).  Also clean up
text, bpchar, varchar, and bit/varbit to eliminate duplicate code and
thereby reduce the probability of similar inconsistencies arising in
the future.
This commit is contained in:
Tom Lane
2001-05-03 19:00:37 +00:00
parent 77fe28f33e
commit 2792374cff
13 changed files with 536 additions and 747 deletions

View File

@ -62,7 +62,8 @@ SELECT '' AS six, ABSTIME_TBL.*
| current
| infinity
| Sat May 10 23:59:12 1947 PDT
(6 rows)
| invalid
(7 rows)
SELECT '' AS six, ABSTIME_TBL.*
WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1;
@ -74,7 +75,8 @@ SELECT '' AS six, ABSTIME_TBL.*
| current
| infinity
| -infinity
(6 rows)
| invalid
(7 rows)
SELECT '' AS one, ABSTIME_TBL.*
WHERE abstime 'current' = ABSTIME_TBL.f1;

View File

@ -62,7 +62,8 @@ SELECT '' AS six, ABSTIME_TBL.*
| current
| infinity
| Sat May 10 23:59:12 1947 PST
(6 rows)
| invalid
(7 rows)
SELECT '' AS six, ABSTIME_TBL.*
WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1;
@ -74,7 +75,8 @@ SELECT '' AS six, ABSTIME_TBL.*
| current
| infinity
| -infinity
(6 rows)
| invalid
(7 rows)
SELECT '' AS one, ABSTIME_TBL.*
WHERE abstime 'current' = ABSTIME_TBL.f1;

View File

@ -265,8 +265,11 @@ SELECT '' AS "47", d1 FROM TIMESTAMP_TBL
WHERE d1 > timestamp '1997-01-02' and d1 != timestamp 'current';
47 | d1
----+---------------------------------
| invalid
| infinity
| Mon Feb 10 17:32:01 1997 PST
| invalid
| invalid
| Mon Feb 10 17:32:01.00 1997 PST
| Mon Feb 10 17:32:02.00 1997 PST
| Mon Feb 10 17:32:01.40 1997 PST
@ -312,7 +315,7 @@ SELECT '' AS "47", d1 FROM TIMESTAMP_TBL
| Sat Jan 01 17:32:01 2000 PST
| Sun Dec 31 17:32:01 2000 PST
| Mon Jan 01 17:32:01 2001 PST
(47 rows)
(50 rows)
SELECT '' AS "15", d1 FROM TIMESTAMP_TBL
WHERE d1 < timestamp '1997-01-02' and d1 != timestamp 'current';
@ -346,10 +349,13 @@ SELECT '' AS "62", d1 FROM TIMESTAMP_TBL
WHERE d1 != timestamp '1997-01-02' and d1 != timestamp 'current';
62 | d1
----+---------------------------------
| invalid
| -infinity
| infinity
| epoch
| Mon Feb 10 17:32:01 1997 PST
| invalid
| invalid
| Mon Feb 10 17:32:01.00 1997 PST
| Mon Feb 10 17:32:02.00 1997 PST
| Mon Feb 10 17:32:01.40 1997 PST
@ -408,7 +414,7 @@ SELECT '' AS "62", d1 FROM TIMESTAMP_TBL
| Sat Jan 01 17:32:01 2000 PST
| Sun Dec 31 17:32:01 2000 PST
| Mon Jan 01 17:32:01 2001 PST
(62 rows)
(65 rows)
SELECT '' AS "16", d1 FROM TIMESTAMP_TBL
WHERE d1 <= timestamp '1997-01-02' and d1 != timestamp 'current';
@ -436,8 +442,11 @@ SELECT '' AS "48", d1 FROM TIMESTAMP_TBL
WHERE d1 >= timestamp '1997-01-02' and d1 != timestamp 'current';
48 | d1
----+---------------------------------
| invalid
| infinity
| Mon Feb 10 17:32:01 1997 PST
| invalid
| invalid
| Mon Feb 10 17:32:01.00 1997 PST
| Mon Feb 10 17:32:02.00 1997 PST
| Mon Feb 10 17:32:01.40 1997 PST
@ -484,7 +493,7 @@ SELECT '' AS "48", d1 FROM TIMESTAMP_TBL
| Sat Jan 01 17:32:01 2000 PST
| Sun Dec 31 17:32:01 2000 PST
| Mon Jan 01 17:32:01 2001 PST
(48 rows)
(51 rows)
SELECT '' AS "66", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL;
66 | one_year