Re: Additional minor pg_dump cleanups

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Additional minor pg_dump cleanups
Date: 2024-07-04 08:17:49
Message-ID: 6AC1D20A-0335-4790-AB88-2AA50FC65F4B@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 3 Jul 2024, at 13:29, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:

> With the function *getPublications* I think it would be good to free up the allocated memory?
>
> }
> + pg_free(pubinfo);
> +cleanup:
> PQclear(res);

Since the pubinfo is recorded in the DumpableObject and is responsible for
keeping track of which publications to dump, it would be quite incorrect to
free it here.

> With the function *getExtensions* I think it would be good to return NULL in case ntups = 0?
> Otherwise we may end up with an uninitialized variable.
>
> - ExtensionInfo *extinfo;
> + ExtensionInfo *extinfo = NULL;

I guess that won't hurt, though any code inspecting extinfo when numExtensions
is returned as zero is flat-out wrong. It may however silence a static
analyzer so there is that.

> Funny, the function *getExtensionMembership* does not use the parameter ExtensionInfo extinfo.
> getExtensions does not have another caller, Is it really necessary?

Yes, see processExtensionTables().

--
Daniel Gustafsson

Attachment Content-Type Size
v2-0002-Add-fastpaths-for-when-no-objects-are-found.patch application/octet-stream 1.8 KB
v2-0001-Remove-superfluous-PQExpBuffer-resetting.patch application/octet-stream 787 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florents Tselai 2024-07-04 08:19:46 Re: SQL Property Graph Queries (SQL/PGQ)
Previous Message Michael Paquier 2024-07-04 08:09:25 pgsql: Add pg_get_acl() to get the ACL for a database object