Re: gzgetc() is hazardous to your health

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Date: 2025-10-19T16:57:16Z
Lists: pgsql-hackers
I wrote:
> What I think we ought to do about this is get rid of our one usage
> of gzgetc(), replacing it with a one-byte gzread() operation.
> That's not lovely from a speed perspective, but I don't think that
> reading a pg_dump TOC file is really speed-critical.

In the light of morning I had a better, or at least easier, idea:
just #undef gzgetc and fall back on the underlying function.
That's at least a little faster than gzread(), too.

			regards, tom lane



Commits

  1. Don't rely on zlib's gzgetc() macro.