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

zengman <zengman@halodbtech.com>

From: zengman <zengman@halodbtech.com>
To: Álvaro Herrera <alvherre@kurilemu.de>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-15T15:08:28Z
Lists: pgsql-hackers
Hi Álvaro Herrera,

I removed the <math.h> include from two files `dt_common.c` and `timestamp.c`, and the code compiles successfully in my environment.
Would you consider adding this to the patch?

```
postgres@zxm-VMware-Virtual-Platform:~/code/postgres$ git diff
diff --git a/src/interfaces/ecpg/pgtypeslib/dt_common.c b/src/interfaces/ecpg/pgtypeslib/dt_common.c
index c4119ab7932..0e26ed67cb1 100644
--- a/src/interfaces/ecpg/pgtypeslib/dt_common.c
+++ b/src/interfaces/ecpg/pgtypeslib/dt_common.c
@@ -4,7 +4,6 @@
 
 #include <time.h>
 #include <ctype.h>
-#include <math.h>
 
 #include "common/string.h"
 #include "dt.h"
diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c
index 7cf433266f4..087725a44e7 100644
--- a/src/interfaces/ecpg/pgtypeslib/timestamp.c
+++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c
@@ -5,7 +5,6 @@
 
 #include <time.h>
 #include <limits.h>
-#include <math.h>
 
 #ifdef __FAST_MATH__
 #error -ffast-math is known to break this code
```

--
Regards,
Man Zeng
www.openhalo.org

Commits

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

  2. Remove unnecessary uses of Abs()

  3. Basic binary heap implementation.