Re: Add memory context type to pg_backend_memory_contexts view

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Add memory context type to pg_backend_memory_contexts view
Дата
Msg-id ZlpxfWV02MmKA3Go@paquier.xyz
обсуждение исходный текст
Ответ на Re: Add memory context type to pg_backend_memory_contexts view  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-hackers
On Fri, May 31, 2024 at 12:35:58PM +1200, David Rowley wrote:
> This follows what we do in other places.  If you look at explain.c,
> you'll see lots of "???"s.
>
> I think if you're worried about corrupted memory, then garbled output
> in pg_get_backend_memory_contexts wouldn't be that high on the list of
> concerns.

+    const char *type;
[...]
+    switch (context->type)
+    {
+        case T_AllocSetContext:
+            type = "AllocSet";
+            break;
+        case T_GenerationContext:
+            type = "Generation";
+            break;
+        case T_SlabContext:
+            type = "Slab";
+            break;
+        case T_BumpContext:
+            type = "Bump";
+            break;
+        default:
+            type = "???";
+            break;
+    }

Yeah, it's a common practice to use that as fallback.  What you are
doing is OK, and it is not possible to remove the default case as
these are nodetags to generate warnings if a new value needs to be
added.

This patch looks like a good idea, so +1 from here.  (PS: catversion
bump).
--
Michael

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alexander Lakhin
Дата:
Сообщение: Re: To what extent should tests rely on VACUUM ANALYZE?
Следующее
От: "a.kozhemyakin"
Дата:
Сообщение: pltcl crashes due to a syntax error