Skip to content

Commit

Permalink
Merge pull request #1672 from sergey-safarov/psql
Browse files Browse the repository at this point in the history
db_postgres: Fixed blob hex encoding (#1255)
  • Loading branch information
miconda committed Oct 12, 2018
2 parents 2db33ab + 5557a44 commit 167ff2b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/modules/db_postgres/km_pg_con.c
Expand Up @@ -52,6 +52,7 @@ struct pg_con *db_postgres_new_connection(struct db_id *id)
int i = 0;
const char *keywords[10], *values[10];
char to[16];
PGresult *res;

LM_DBG("db_id = %p\n", id);

Expand Down Expand Up @@ -141,6 +142,15 @@ struct pg_con *db_postgres_new_connection(struct db_id *id)
}
#endif

res = PQexec(ptr->con, "SET bytea_output=escape");
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
LM_ERR("cannot set blob output escaping format\n");
PQclear(res);
goto err;
}
PQclear(res);

return ptr;

err:
Expand Down

0 comments on commit 167ff2b

Please sign in to comment.