Re: Parent/child context relation in pg_get_backend_memory_contexts()

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Melih Mutlu <m.melihmutlu@gmail.com>, Robert Haas <robertmhaas@gmail.com>, Michael Paquier <michael@paquier.xyz>, torikoshia <torikoshia@oss.nttdata.com>, Andres Freund <andres@anarazel.de>, Stephen Frost <sfrost@snowman.net>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-07-28T21:19:51Z
Lists: pgsql-hackers
On Mon, 29 Jul 2024 at 04:31, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> It is not clear to me exactly which of these pointers should be
> presumed to be possibly-null, but certainly testing ident after
> storing through it is pretty pointless.  Maybe what was intended
> was
>
> -       if (ident && strcmp(*name, "dynahash") == 0)
> +       if (*name && strcmp(*name, "dynahash") == 0)

It should be *ident. I just missed adding the pointer dereference when
moving that code to a function.

Thanks for the report. I'll fix shortly.

David



Commits

  1. Add missing pointer dereference in pg_backend_memory_contexts view

  2. Add path column to pg_backend_memory_contexts view

  3. Allow memory contexts to have both fixed and variable ident strings.