summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <daniel.goodliffe@pressassociation.com>2017-01-03 14:43:28 +0000
committerDan Goodliffe <daniel.goodliffe@pressassociation.com>2017-01-03 15:16:50 +0000
commit34c0479cdfe6339cddd0f08df576b5b0babad5e3 (patch)
treeb93dd0a6877be3e91da98a6969115053d72f1d46
parentCo-variant return of PQ connection from PQ mock (diff)
downloadlibdbpp-postgresql-34c0479cdfe6339cddd0f08df576b5b0babad5e3.tar.bz2
libdbpp-postgresql-34c0479cdfe6339cddd0f08df576b5b0babad5e3.tar.xz
libdbpp-postgresql-34c0479cdfe6339cddd0f08df576b5b0babad5e3.zip
Only set unlogged for mocked tables on server versions 9.5 and above
-rw-r--r--libpqpp/pq-mock.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libpqpp/pq-mock.cpp b/libpqpp/pq-mock.cpp
index 97882ba..f2090a4 100644
--- a/libpqpp/pq-mock.cpp
+++ b/libpqpp/pq-mock.cpp
@@ -29,7 +29,8 @@ AdHocFormatter(MockSetUnlogged, "ALTER TABLE %?.%? SET UNLOGGED");
void
Mock::SetTablesToUnlogged() const
{
- auto c = DB::ConnectionPtr(openConnection());
+ auto c = ConnectionPtr(openConnection());
+ if (c->serverVersion() < 90500) return;
auto s = c->select(R"SQL(
SELECT n.nspname, c.relname
FROM pg_class c, pg_namespace n