Karthik Segpi <karthik.segpi@xxxxxxxxx> writes: > I have a 'bytea' column in the database, onto which my custom C application > is inserting encrypted data. Before inserting, I am calling > 'PQescapebytea()' to escape the ciphertext. However, after SELECT, the data > needs to be 'un-escaped' before attempting to decrypt. I am trying to > 'un-escape' using 'PQunescapebytea'. However, I am finding that > 'PQunescapebytea' is not exact inverse of 'PQescapebytea'. It's not supposed to be, as the fine manual points out: This conversion is not exactly the inverse of PQescapeBytea, because the string is not expected to be "escaped" when received from PQgetvalue. In particular this means there is no need for string quoting considerations, and so no need for a PGconn parameter. If you're having problems, it's probably because you are misusing one function or the other. A likely bet is that you're passing the output of PQescapeBytea through some additional processing rather than just sticking it into an INSERT statement with single quotes around it. But it's impossible to be sure without seeing a detailed example of what you're doing, on both the insertion and extraction sides. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general