Re: small pg_dump code cleanup

Neil Conway <neil.conway@gmail.com>

From: Neil Conway <neil.conway@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2024-06-05T16:22:03Z
Lists: pgsql-hackers
On Wed, Jun 5, 2024 at 11:14 AM Nathan Bossart <nathandbossart@gmail.com>
wrote:

>  In fact, many of the functions in this area don't actually need to

return anything, so we can trim some code and hopefully reduce confusion a
> bit.  Patch attached.
>

Nice cleanup! Two minor comments:

(1) Names like `getXXX` for these functions suggest to me that they return
a value, rather than side-effecting. I realize some variants continue to
return a value, but the majority no longer do. Perhaps a name like
lookupXXX() or readXXX() would be clearer?

(2) These functions malloc() a single ntups * sizeof(struct) allocation and
then index into it to fill-in each struct before entering it into the hash
table. It might be more straightforward to just malloc each individual
struct.

Neil

Commits

  1. pg_dump: Remove some unused return values.

  2. In pg_dump, use simplehash.h to look up dumpable objects by OID.