Search code examples
postgresqlencryptionpgcrypto

How to encrypt entire tables using pgcrypto in PostgreSQL


I am looking to store all of my tables in PostgreSQL as aes 256 encrypted (due to client requirements). I will look at decrypting few columns for my analysis later. But apparently the encryption process is a drag as I have loads of tables. I am using update statements to pgp_sym_encrypt each column individually.

Is there a way to update the entire table easily or is there a better process instead of writing manual column update queries in each table??

Many thanks


Solution

  • Is there a way to update the entire table easily or is there a better process instead of writing manual column update queries in each table?

    No, there isn't.

    PostgreSQL doesn't support encrypted tables. It's not something an extension can really add, it'd have to be added to the core database engine, and nobody's done the work required to add the feature yet.

    Most people who need this do the encryption application-side and store bytea fields in the table.