aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-01-13 16:48:16 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-01-13 16:52:53 +0300
commit8434d8c04a67d51f0f9e54784c613623fe21d904 (patch)
tree2e485834e97bc9885abbbaad75cce22ece45e732
parenteb7d4859c62ef17ad2176f41f73467ca7bb1b7f7 (diff)
Adapt to to_regclass() parameter type change
Starting 9.6 it requires text type rather than cstring type.
-rw-r--r--odb/pgsql/database.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/odb/pgsql/database.cxx b/odb/pgsql/database.cxx
index e7f3bd0..9e817ad 100644
--- a/odb/pgsql/database.cxx
+++ b/odb/pgsql/database.cxx
@@ -326,9 +326,14 @@ namespace odb
// Note that to_regclass() seems happy to accept a quoted table name.
//
+ // Also note that starting 9.6 it requires text type rather than
+ // cstring type.
+ //
select_statement st (c,
"odb_database_schema_version_exists",
- "SELECT to_regclass($1::cstring) IS NOT NULL",
+ c.server_version () >= 90600
+ ? "SELECT to_regclass($1::text) IS NOT NULL"
+ : "SELECT to_regclass($1::cstring) IS NOT NULL",
false, // Don't process.
false, // Don't optimize.
param_types,