Hello Daniel Think i found way how to properly escape blob strings. need to execute `SET bytea_output=escape;` command when connection created This maybe done in function [`db_postgres_new_connection`](https://github.com/kamailio/kamailio/blob/master/src/modules/db_postgres/km_...).
By default psql output BLOBs in hex format. After `SET bytea_output=escape;` this behaviour is changed to expected by Kamailio. ``` pg1b:~$ psql kamailio psql (9.6.3) Type "help" for help.
kamailio=# CREATE TABLE blob_table (blob bytea); CREATE TABLE kamailio=# INSERT INTO blob_table VALUES ('Kamailio'); INSERT 0 1 kamailio=# SELECT * FROM blob_table; blob -------------------- \x4b616d61696c696f (1 row)
kamailio=# SET bytea_output=escape; SET kamailio=# SELECT * FROM blob_table; blob ---------- Kamailio (1 row)
kamailio=# ``` Could you suggest patch and then i will test on my servers.