Decrease size of database (with an expression index)?
If hash() is an IMMUTABLE function (which should be the case for a function called "hash"!) you can omit storing the functionally dependent attribute_one in the table altogether and add an expression index to support queries on the expression hash(customer_one):

CREATE TABLE customer (
   privatekeytype customer_type     -- move the enum to 1st pos to save some more 
 , customer_one   text PRIMARY KEY
 , attribute_two  text
);


Expression index:

CREATE INDEX customer_attribute_one_idx ON customer (hash(customer_one));


This is exactly as big (identical) as the index supporting your original UNIQUE constraint on the redundant column attribute_one.

Query:

SELECT *
FROM   customer 
WHERE  'XXX' IN (customer_one, hash(customer_one));


Testing with EXPLAIN you'll see index or bitmap index scans like:


-&gt;  BitmapOr  (cost=5.34..5.34 rows=5 width=0)
     -&gt;  Bitmap Index Scan on customer_pkey  (cost=0.00..2.66 rows=1 width=0)
           Index Cond: ('XXX'::text = customer.customer_one)
     -&gt;  Bitmap Index Scan on customer_attribute_one_idx  (cost=0.00..2.68 rows=4 width=0)
           Index Cond: ('XXX'::text = hash(customer.customer_one))



About the same performance as with the redundant table column or faster since the table is smaller, yet - which helps overall performance in various ways.

Moving the enum to first position saves a few bytes of alignment padding per row as explained in my previous answer:


Why is my database 12 times bigger than inserted data?


Why does the function have to be IMMUTABLE? See:


How do IMMUTABLE, STABLE and VOLATILE keywords effect behaviour of function?
Does PostgreSQL support “accent insensitive” collations?