From 652522da4fd265a0df28804e688361925622daf2 Mon Sep 17 00:00:00 2001 From: Dennis Kovalenko Date: Fri, 25 Oct 2024 12:17:06 +0300 Subject: [PATCH] Fix -Wvla-cxx-extension warning (#1084) --- src/backend/gpopt/translate/CTranslatorUtils.cpp | 8 ++++---- src/backend/gpopt/utils/COptTasks.cpp | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/backend/gpopt/translate/CTranslatorUtils.cpp b/src/backend/gpopt/translate/CTranslatorUtils.cpp index 3423621a78ed..1d2a980a4764 100644 --- a/src/backend/gpopt/translate/CTranslatorUtils.cpp +++ b/src/backend/gpopt/translate/CTranslatorUtils.cpp @@ -387,8 +387,8 @@ CTranslatorUtils::ResolvePolymorphicTypes(CMemoryPool *mp, const ULONG num_args = std::min(num_arg_types, num_args_from_query); const ULONG total_args = num_args + num_return_args; - OID arg_types[total_args]; - char arg_modes[total_args]; + std::vector arg_types(total_args); + std::vector arg_modes(total_args); // copy the first 'num_args' function argument types ListCell *arg_type = nullptr; @@ -410,8 +410,8 @@ CTranslatorUtils::ResolvePolymorphicTypes(CMemoryPool *mp, arg_modes[arg_index++] = PROARGMODE_TABLE; } - if (!gpdb::ResolvePolymorphicArgType(total_args, arg_types, arg_modes, - funcexpr)) + if (!gpdb::ResolvePolymorphicArgType(total_args, arg_types.data(), + arg_modes.data(), funcexpr)) { GPOS_RAISE( gpdxl::ExmaDXL, gpdxl::ExmiDXLUnrecognizedType, diff --git a/src/backend/gpopt/utils/COptTasks.cpp b/src/backend/gpopt/utils/COptTasks.cpp index 541389be2951..56dec50c3a09 100644 --- a/src/backend/gpopt/utils/COptTasks.cpp +++ b/src/backend/gpopt/utils/COptTasks.cpp @@ -987,14 +987,15 @@ COptTasks::PrintMissingStatsWarning(CMemoryPool *mp, CMDAccessor *md_accessor, if (0 < rel_stats->Size()) { - int length = NAMEDATALEN * rel_stats->Size() + 200; - char msgbuf[length]; - snprintf( - msgbuf, sizeof(msgbuf), - "One or more columns in the following table(s) do not have statistics: %s", - CreateMultiByteCharStringFromWCString(wcstr.GetBuffer())); + CWStringDynamic msgbuf(mp); + msgbuf.AppendFormat( + GPOS_WSZ_LIT( + "One or more columns in the following table(s) do not have statistics: %ls"), + wcstr.GetBuffer()); + GpdbEreport( - ERRCODE_SUCCESSFUL_COMPLETION, NOTICE, msgbuf, + ERRCODE_SUCCESSFUL_COMPLETION, NOTICE, + CreateMultiByteCharStringFromWCString(msgbuf.GetBuffer()), "For non-partitioned tables, run analyze ()." " For partitioned tables, run analyze rootpartition ()." " See log for columns missing statistics.");