aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,