mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-03 15:35:17 +00:00
[#2445] fix PgSqlLeaseMgr::isJsonSupported() from always returning true
This commit is contained in:
@@ -2342,8 +2342,8 @@ PgSqlLeaseMgr::isJsonSupported() const {
|
|||||||
0, 0, 0, 0, 0));
|
0, 0, 0, 0, 0));
|
||||||
ctx->conn_.checkStatementError(r, tagged_statements[stindex]);
|
ctx->conn_.checkStatementError(r, tagged_statements[stindex]);
|
||||||
|
|
||||||
bool const json_supported(PgSqlExchange::getRawColumnValue(r, 0, 0));
|
std::string const json_supported(PgSqlExchange::getRawColumnValue(r, 0, 0));
|
||||||
return json_supported;
|
return json_supported == "t";
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaseStatsQueryPtr
|
LeaseStatsQueryPtr
|
||||||
|
@@ -1085,14 +1085,26 @@ TEST_F(PgSqlLeaseMgrTest, checkLimits) {
|
|||||||
if (!LeaseMgrFactory::instance().isJsonSupported()) {
|
if (!LeaseMgrFactory::instance().isJsonSupported()) {
|
||||||
ASSERT_THROW_MSG(LeaseMgrFactory::instance().checkLimits4(
|
ASSERT_THROW_MSG(LeaseMgrFactory::instance().checkLimits4(
|
||||||
isc::data::Element::createMap()), isc::db::DbOperationError,
|
isc::data::Element::createMap()), isc::db::DbOperationError,
|
||||||
"unable to set up for storing all results for "
|
"Statement exec failed for: check_lease4_limits, status: 7sqlstate:[ 42883 ], "
|
||||||
"<SELECT checkLease4Limits(?)>, reason: FUNCTION "
|
"reason: ERROR: operator does not exist: json -> unknown\n"
|
||||||
"keatest.JSON_EXTRACT does not exist (error code 1305)");
|
"LINE 1: ...* FROM JSON_ARRAY_ELEMENTS(json_cast(user_context)->'ISC'->'...\n"
|
||||||
|
" ^\n"
|
||||||
|
"HINT: No operator matches the given name and argument type(s). "
|
||||||
|
"You might need to add explicit type casts.\n"
|
||||||
|
"QUERY: SELECT * FROM JSON_ARRAY_ELEMENTS(json_cast(user_context)"
|
||||||
|
"->'ISC'->'limits'->'client-classes')\n"
|
||||||
|
"CONTEXT: PL/pgSQL function checklease4limits(text) line 10 at FOR over SELECT rows\n");
|
||||||
ASSERT_THROW_MSG(LeaseMgrFactory::instance().checkLimits6(
|
ASSERT_THROW_MSG(LeaseMgrFactory::instance().checkLimits6(
|
||||||
isc::data::Element::createMap()), isc::db::DbOperationError,
|
isc::data::Element::createMap()), isc::db::DbOperationError,
|
||||||
"unable to set up for storing all results for "
|
"Statement exec failed for: check_lease6_limits, status: 7sqlstate:[ 42883 ], "
|
||||||
"<SELECT checkLease6Limits(?)>, reason: FUNCTION "
|
"reason: ERROR: operator does not exist: json -> unknown\n"
|
||||||
"keatest.JSON_EXTRACT does not exist (error code 1305)");
|
"LINE 1: ...* FROM JSON_ARRAY_ELEMENTS(json_cast(user_context)->'ISC'->'...\n"
|
||||||
|
" ^\n"
|
||||||
|
"HINT: No operator matches the given name and argument type(s). "
|
||||||
|
"You might need to add explicit type casts.\n"
|
||||||
|
"QUERY: SELECT * FROM JSON_ARRAY_ELEMENTS(json_cast(user_context)"
|
||||||
|
"->'ISC'->'limits'->'client-classes')\n"
|
||||||
|
"CONTEXT: PL/pgSQL function checklease6limits(text) line 10 at FOR over SELECT rows\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user