diff --git a/doc/2-getting-started.md b/doc/2-getting-started.md index 0faaf49e359..02f7664fc71 100644 --- a/doc/2-getting-started.md +++ b/doc/2-getting-started.md @@ -408,6 +408,7 @@ RHEL/CentOS 5/6: RHEL/CentOS 7: # yum install postgresql-server postgresql + # postgresql-setup --initdb # systemctl enable postgresql # systemctl start postgresql @@ -471,7 +472,7 @@ authentication method and restart the postgresql server. # IPv6 local connections: host all all ::1/128 ident - # /etc/init.d/postgresql restart + # service postgresql restart After creating the database and permissions you can import the Icinga 2 IDO diff --git a/lib/db_ido_pgsql/idopgsqlconnection.cpp b/lib/db_ido_pgsql/idopgsqlconnection.cpp index fca4e8f8429..2908ca8a7c3 100644 --- a/lib/db_ido_pgsql/idopgsqlconnection.cpp +++ b/lib/db_ido_pgsql/idopgsqlconnection.cpp @@ -217,8 +217,16 @@ void IdoPgsqlConnection::Reconnect(void) BOOST_THROW_EXCEPTION(std::runtime_error(message)); } + IdoPgsqlResult result; + + /* explicitely require legacy mode for string escaping in PostgreSQL >= 9.1 + * changing standard_conforming_strings to on by default + */ + if (PQserverVersion(m_Connection) >= 90100) + result = Query("SET standard_conforming_strings TO off"); + String dbVersionName = "idoutils"; - IdoPgsqlResult result = Query("SELECT version FROM " + GetTablePrefix() + "dbversion WHERE name=E'" + Escape(dbVersionName) + "'"); + result = Query("SELECT version FROM " + GetTablePrefix() + "dbversion WHERE name=E'" + Escape(dbVersionName) + "'"); Dictionary::Ptr row = FetchRow(result, 0);