mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Rewrite interval_hash() so that the hashcodes are equal for values that
interval_eq() considers equal. I'm not sure how that fundamental requirement escaped us through multiple revisions of this hash function, but there it is; it's been wrong since interval_hash was first written for PG 7.1. Per bug #4748 from Roman Kononov. Backpatch to all supported releases. This patch changes the contents of hash indexes for interval columns. That's no particular problem for PG 8.4, since we've broken on-disk compatibility of hash indexes already; but it will require a migration warning note in the next minor releases of all existing branches: "if you have any hash indexes on columns of type interval, REINDEX them after updating".
This commit is contained in:
@@ -241,3 +241,7 @@ SET IntervalStyle to postgres_verbose;
|
||||
select interval '-10 mons -3 days +03:55:06.70';
|
||||
select interval '1 year 2 mons 3 days 04:05:06.699999';
|
||||
select interval '0:0:0.7', interval '@ 0.70 secs', interval '0.7 seconds';
|
||||
|
||||
-- check that '30 days' equals '1 month' according to the hash function
|
||||
select '30 days'::interval = '1 month'::interval as t;
|
||||
select interval_hash('30 days'::interval) = interval_hash('1 month'::interval) as t;
|
||||
|
||||
Reference in New Issue
Block a user