From e1817c5404d54145250a7dfd27a9bb4a1b4fee06 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 10 Apr 2018 14:42:33 +0200 Subject: [PATCH] auth: Allocate new statements after reconnecting to PostgreSQL (cherry picked from commit db737018dab727d42873da36dd0b3d1cba3286f1) --- modules/gpgsqlbackend/gpgsqlbackend.cc | 2 ++ pdns/backends/gsql/gsqlbackend.hh | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/modules/gpgsqlbackend/gpgsqlbackend.cc b/modules/gpgsqlbackend/gpgsqlbackend.cc index 473b5079ed..b708b12e2c 100644 --- a/modules/gpgsqlbackend/gpgsqlbackend.cc +++ b/modules/gpgsqlbackend/gpgsqlbackend.cc @@ -60,6 +60,8 @@ void gPgSQLBackend::reconnect() if (d_db) { d_db->reconnect(); + + allocateStatements(); } } diff --git a/pdns/backends/gsql/gsqlbackend.hh b/pdns/backends/gsql/gsqlbackend.hh index 7a6fcff909..9125f863e3 100644 --- a/pdns/backends/gsql/gsqlbackend.hh +++ b/pdns/backends/gsql/gsqlbackend.hh @@ -52,6 +52,13 @@ public: d_db=db; if (d_db) { d_db->setLog(::arg().mustDo("query-logging")); + allocateStatements(); + } + } + + void allocateStatements() + { + if (d_db) { d_NoIdQuery_stmt = d_db->prepare(d_NoIdQuery, 2); d_IdQuery_stmt = d_db->prepare(d_IdQuery, 3); d_ANYNoIdQuery_stmt = d_db->prepare(d_ANYNoIdQuery, 1); -- 2.47.2