Before fix, the query for bulk_update will be cast as:
pgp_sym_encrypt((CASE WHEN ("crm_contact"."id" = %s) THEN pgp_sym_encrypt(%s, 'xxxxxxx_pgcrypto_key') ELSE NULL END)::bytea, 'xxxxxxx_pgcrypto_key')
Which will give error like:
django.db.utils.ProgrammingError: function pgp_sym_encrypt(bytea, unknown) does not exist LINE 1: UPDATE "crm_contact" SET "phone_number_pgp" = pgp_sym_encryp... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.
The newly added code will check if the {value} needs to be encrypted.
Fix a crashing issue when using bulk_update:
Before fix, the query for bulk_update will be cast as:
pgp_sym_encrypt((CASE WHEN ("crm_contact"."id" = %s) THEN pgp_sym_encrypt(%s, 'xxxxxxx_pgcrypto_key') ELSE NULL END)::bytea, 'xxxxxxx_pgcrypto_key')
Which will give error like:
django.db.utils.ProgrammingError: function pgp_sym_encrypt(bytea, unknown) does not exist LINE 1: UPDATE "crm_contact" SET "phone_number_pgp" = pgp_sym_encryp... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.
The newly added code will check if the {value} needs to be encrypted.