diff options
author | Christian Kastner <debian@kvr.at> | 2011-03-29 12:00:56 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-03-29 12:00:56 +0200 |
commit | 9003632c7df5e6020b06b7d19e1c226ea46640de (patch) | |
tree | fc95080e30d89edb11704e3fdd95c6af00f227f2 /plugins/ompgsql | |
parent | 12f126a811dd08553ac9387392c3a506eba3fe55 (diff) | |
download | rsyslog-9003632c7df5e6020b06b7d19e1c226ea46640de.tar.gz rsyslog-9003632c7df5e6020b06b7d19e1c226ea46640de.tar.xz rsyslog-9003632c7df5e6020b06b7d19e1c226ea46640de.zip |
Force ANSI SQL treatment of strings for Postgres
Signed-off-by: Rainer Gerhards <rgerhards@adiscon.com>
Diffstat (limited to 'plugins/ompgsql')
-rw-r--r-- | plugins/ompgsql/ompgsql.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c index ab8e4d2c..ea4b4b75 100644 --- a/plugins/ompgsql/ompgsql.c +++ b/plugins/ompgsql/ompgsql.c @@ -149,8 +149,13 @@ static rsRetVal initPgSQL(instanceData *pData, int bSilent) dbgprintf("host=%s dbname=%s uid=%s\n",pData->f_dbsrv,pData->f_dbname,pData->f_dbuid); + /* Force PostgreSQL to use ANSI-SQL conforming strings, otherwise we may + * get all sorts of side effects (e.g.: backslash escapes) and warnings + */ + const char *PgConnectionOptions = "-c standard_conforming_strings=on"; + /* Connect to database */ - if((pData->f_hpgsql=PQsetdbLogin(pData->f_dbsrv, NULL, NULL, NULL, + if((pData->f_hpgsql=PQsetdbLogin(pData->f_dbsrv, NULL, PgConnectionOptions, NULL, pData->f_dbname, pData->f_dbuid, pData->f_dbpwd)) == NULL) { reportDBError(pData, bSilent); closePgSQL(pData); /* ignore any error we may get */ |