This looks like a lot of complexity for something that can already be done with ordinary columns: ciphertext as bytea, HMAC blind index as bytea with btree index, int4[] with a GIN index for trigram tokens.
I'm also not sure about the overall usefulness. The blind index gives fast equality lookups, but no ranges or ordering (as with all well encrypted things). The trigrams are more promising, but they leak a lot of information, and truncating them enough to counteract that quickly removes their trigram power. Could you give some examples of the data to be stored and how it would be searched? 1. A true base type with operator classes, or a composite type plus index > expressions? > Neither, as regular columns with existing types can do this already. > 2. Is contrib the right home, or should this stay on PGXN first? > PGXN. There is a high bar for adding things to contrib (and existing modules in there are not a good guide) > 3. Any overlap with the ongoing TDE or column-encryption discussions I > should read first? > TDE is a different threat model. The column-encryption idea is closer, and there are some neat ideas there, though none that solve your substring search problem. See for example: https://www.postgresql.org/message-id/flat/89157929-c2b6-817b-6025-8e4b2d89d88f%40enterprisedb.com (warning, it's a fascinating but long discussion) Cheers, Greg
