From 8434d8c04a67d51f0f9e54784c613623fe21d904 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 13 Jan 2018 16:48:16 +0300 Subject: Adapt to to_regclass() parameter type change Starting 9.6 it requires text type rather than cstring type. --- odb/pgsql/database.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'odb') 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, -- cgit v1.1