summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Ramírez Norambuena <a@rodrigoramirez.com>2017-09-19 07:22:50 -0300
committerRodrigo Ramirez Norambuena <a@rodrigoramirez.com>2017-09-21 11:26:06 -0500
commit339676b77db2376da5323d4399a3c7bf80c184e7 (patch)
tree3b0d3c7b8fb6b53c9d04c9464fcfee2875bfab73
parent8ee7ed020f184b0d93c3fc5c6088d721979990ea (diff)
res_config_pgsql: Fix removed support to previous for versions PostgreSQL 9.1
In PostgreSQL 9.1 the backslash are string literals and not the escape of characters. In previous issue ASTERISK_26057 was fixed the use of escape LIKE but the support for old version of Postgresql than 9.1 was dropped. The sentence before make was "ESCAPE '\'" but in version before than 9.1 need it to be as follow "ESCAPE '\\'". ASTERISK-27283 Change-Id: I96d9ee1ed7693ab17503cb36a9cd72847165f949
-rw-r--r--res/res_config_pgsql.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index 8d090cce8..4cbfd61ae 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -54,6 +54,7 @@ AST_THREADSTORAGE(semibuf_buf);
static PGconn *pgsqlConn = NULL;
static int version;
#define has_schema_support (version > 70300 ? 1 : 0)
+#define USE_BACKSLASH_AS_STRING (version >= 90100 ? 1 : 0)
#define MAX_DB_OPTION_SIZE 64
@@ -386,7 +387,7 @@ static struct columns *find_column(struct tables *t, const char *colname)
}
#define IS_SQL_LIKE_CLAUSE(x) ((x) && ast_ends_with(x, " LIKE"))
-static char *ESCAPE_CLAUSE = " ESCAPE '\\'";
+#define ESCAPE_CLAUSE (USE_BACKSLASH_AS_STRING ? " ESCAPE '\\'" : " ESCAPE '\\\\'")
static struct ast_variable *realtime_pgsql(const char *database, const char *tablename, const struct ast_variable *fields)
{