The document here: http://www.postgresql.org/docs/8.2/static/encryption-options.html describes several approaches to data encryption using postgresql.
I would like to know if there is any security advantage for encrypting certain columns using pgcrypto instead of simply encrypting the entire partition on which the database is located. It seems to me that pgcrypto is cumbersome to use (instead of just using SQL queries, without worrying that they are encrypted), so there must be a reason for it to exist. Itβs just that people may not be able to manage the database server (shared hosts / etc ...), so they have to do with pgcrypto or is there a reason for security?
In my particular case, the application code and the database are on the same host, so compromising the server itself during its operation will lead to data leakage in any case (you could look for the encryption key in the code in one case or just get the data from the installed volumes in another).
Edit: I forgot to mention, also in this particular case, the data is used by the server, not the client, that is, the client cannot provide the key at run time, it must be on the server in the application code.
source share