summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-07-06 04:16:00 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-07-06 04:16:00 +0000
commit7af3a6fc6f9e2486df37eeac0d61addba09a3551 (patch)
tree1b21c8aa49a58a479fff5912ef125a19b38b3524 /src/test
parentad9a99c24f7084d2511e84efbac3a807b14656f3 (diff)
Fix up hash functions for datetime datatypes so that they don't take
unwarranted liberties with int8 vs float8 values for these types. Specifically, be sure to apply either hashint8 or hashfloat8 depending on HAVE_INT64_TIMESTAMP. Per my gripe of even date.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/opr_sanity.out26
-rw-r--r--src/test/regress/sql/opr_sanity.sql12
2 files changed, 23 insertions, 15 deletions
diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out
index 8b5f64473d5..247c8c95837 100644
--- a/src/test/regress/expected/opr_sanity.out
+++ b/src/test/regress/expected/opr_sanity.out
@@ -980,10 +980,9 @@ WHERE p3.opfmethod = (SELECT oid FROM pg_am WHERE amname = 'btree')
-- For hash we can also do a little better: the support routines must be
-- of the form hash(lefttype) returns int4. There are several cases where
-- we cheat and use a hash function that is physically compatible with the
--- datatype even though there's no cast, so for now we can't check that.
-SELECT p1.amprocfamily, p1.amprocnum,
- p2.oid, p2.proname,
- p3.opfname
+-- datatype even though there's no cast, so this check does find a small
+-- number of entries.
+SELECT p1.amprocfamily, p1.amprocnum, p2.proname, p3.opfname
FROM pg_amproc AS p1, pg_proc AS p2, pg_opfamily AS p3
WHERE p3.opfmethod = (SELECT oid FROM pg_am WHERE amname = 'hash')
AND p1.amprocfamily = p3.oid AND p1.amproc = p2.oid AND
@@ -991,11 +990,20 @@ WHERE p3.opfmethod = (SELECT oid FROM pg_am WHERE amname = 'hash')
OR proretset
OR prorettype != 'int4'::regtype
OR pronargs != 1
--- OR NOT physically_coercible(amproclefttype, proargtypes[0])
- OR amproclefttype != amprocrighttype);
- amprocfamily | amprocnum | oid | proname | opfname
---------------+-----------+-----+---------+---------
-(0 rows)
+ OR NOT physically_coercible(amproclefttype, proargtypes[0])
+ OR amproclefttype != amprocrighttype)
+ORDER BY 1;
+ amprocfamily | amprocnum | proname | opfname
+--------------+-----------+----------------+--------------------
+ 435 | 1 | hashint4 | date_ops
+ 1999 | 1 | timestamp_hash | timestamptz_ops
+ 2222 | 1 | hashchar | bool_ops
+ 2223 | 1 | hashvarlena | bytea_ops
+ 2225 | 1 | hashint4 | xid_ops
+ 2226 | 1 | hashint4 | cid_ops
+ 2229 | 1 | hashvarlena | text_pattern_ops
+ 2231 | 1 | hashvarlena | bpchar_pattern_ops
+(8 rows)
-- Support routines that are primary members of opfamilies must be immutable
-- (else it suggests that the index ordering isn't fixed). But cross-type
diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql
index f93a71ddf9c..54c60c1a6d9 100644
--- a/src/test/regress/sql/opr_sanity.sql
+++ b/src/test/regress/sql/opr_sanity.sql
@@ -790,11 +790,10 @@ WHERE p3.opfmethod = (SELECT oid FROM pg_am WHERE amname = 'btree')
-- For hash we can also do a little better: the support routines must be
-- of the form hash(lefttype) returns int4. There are several cases where
-- we cheat and use a hash function that is physically compatible with the
--- datatype even though there's no cast, so for now we can't check that.
+-- datatype even though there's no cast, so this check does find a small
+-- number of entries.
-SELECT p1.amprocfamily, p1.amprocnum,
- p2.oid, p2.proname,
- p3.opfname
+SELECT p1.amprocfamily, p1.amprocnum, p2.proname, p3.opfname
FROM pg_amproc AS p1, pg_proc AS p2, pg_opfamily AS p3
WHERE p3.opfmethod = (SELECT oid FROM pg_am WHERE amname = 'hash')
AND p1.amprocfamily = p3.oid AND p1.amproc = p2.oid AND
@@ -802,8 +801,9 @@ WHERE p3.opfmethod = (SELECT oid FROM pg_am WHERE amname = 'hash')
OR proretset
OR prorettype != 'int4'::regtype
OR pronargs != 1
--- OR NOT physically_coercible(amproclefttype, proargtypes[0])
- OR amproclefttype != amprocrighttype);
+ OR NOT physically_coercible(amproclefttype, proargtypes[0])
+ OR amproclefttype != amprocrighttype)
+ORDER BY 1;
-- Support routines that are primary members of opfamilies must be immutable
-- (else it suggests that the index ordering isn't fixed). But cross-type