[sr-dev] [kamailio/kamailio] DB Postgres BLOB conversion for presence (#1255)

sergey-safarov notifications at github.com
Sun Oct 7 22:17:49 CEST 2018


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_pg_con.c#L48-L152).

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.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1255#issuecomment-427683551
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20181007/a54dc0bf/attachment.html>


More information about the sr-dev mailing list