Re: [PROPOSAL] Extension: searchable encrypted column type with externally supplied crypto

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: Fabien Roy <fabienlroy(at)yahoo(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PROPOSAL] Extension: searchable encrypted column type with externally supplied crypto
Date: 2026-12-02 05:14:25
Message-ID: CAKAnmmLQJ-TU4CsJhd8TLbu2yGFdeOGTR5WFnO08Zu+PX9+K=g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-12-02 05:22:30 Re: EXPLAIN ANALYZE CREATE TABLE AS EXECUTE runs non-SELECT prepared statements
Previous Message Dilip Kumar 2026-12-02 04:50:16 Re: Preserve conflict log table during upgrade