Re: remove the unneeded header file math.h in binaryheap.c

Álvaro Herrera <alvherre@kurilemu.de>

From: Álvaro Herrera <alvherre@kurilemu.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: liujinyang <21043272@qq.com>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-15T18:28:37Z
Lists: pgsql-hackers
On 2026-Jan-15, Tom Lane wrote:

> Yeah ... my recollection is that some of our inclusions of <math.h>,
> and also of <limits.h>, were needed because assorted platforms didn't
> follow the C/POSIX standards about which headers should provide which
> symbols.  Maybe that's all cleaned up now.  I'd worry about Solaris
> and AIX as being the most likely stragglers.

I think we have enough Solaris in the buildfarm to know if there are any
problems.  As for AIX, we don't support it currently, and I guess we'll
know from the developers if we need any patches there.

> Another likely source of obsolete <math.h> usages is in the datetime
> code, as a leftover from our old floating-point timestamps.

Yeah, there was one in date.h related to that, which I mentioned in my
reply to Andres.

I have just pushed it.  Now it's time for the buildfarm to speak ...


Thanks liujinyang, and welcome -- may your Postgres contribution days be
long and fertile.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"No nos atrevemos a muchas cosas porque son difíciles,
pero son difíciles porque no nos atrevemos a hacerlas" (Séneca)



Commits

  1. Remove #include <math.h> where not needed

  2. Remove unnecessary uses of Abs()

  3. Basic binary heap implementation.