1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Add a 64-bit hash function for type citext.

Amul Sul, reviewed by Hironobu Suzuki

Discussion: https://postgr.es/m/CAAJ_b947JjnNr9Cp45iNjSqKf6PA5mCTmKsRwPjows93YwQrmw@mail.gmail.com
This commit is contained in:
Tom Lane
2018-11-23 13:24:45 -05:00
parent a314c34079
commit 48c41fa974
7 changed files with 69 additions and 2 deletions

View File

@ -89,6 +89,15 @@ SELECT citext_cmp('aardvark'::citext, 'aardVark'::citext) AS zero;
SELECT citext_cmp('AARDVARK'::citext, 'AARDVARK'::citext) AS zero;
SELECT citext_cmp('B'::citext, 'a'::citext) > 0 AS true;
-- Check the citext_hash() and citext_hash_extended() function explicitly.
SELECT v as value, citext_hash(v)::bit(32) as standard,
citext_hash_extended(v, 0)::bit(32) as extended0,
citext_hash_extended(v, 1)::bit(32) as extended1
FROM (VALUES (NULL::citext), ('PostgreSQL'), ('eIpUEtqmY89'), ('AXKEJBTK'),
('muop28x03'), ('yi3nm0d73')) x(v)
WHERE citext_hash(v)::bit(32) != citext_hash_extended(v, 0)::bit(32)
OR citext_hash(v)::bit(32) = citext_hash_extended(v, 1)::bit(32);
-- Do some tests using a table and index.
CREATE TEMP TABLE try (