summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/timeline.c1
-rw-r--r--src/backend/access/transam/twophase.c1
-rw-r--r--src/backend/access/transam/xlogarchive.c1
-rw-r--r--src/backend/commands/dbcommands.c1
-rw-r--r--src/backend/commands/tablespace.c1
-rw-r--r--src/backend/libpq/ifaddr.c1
-rw-r--r--src/backend/port/atomics.c1
-rw-r--r--src/backend/port/dynloader/freebsd.h1
-rw-r--r--src/backend/port/dynloader/netbsd.h1
-rw-r--r--src/backend/port/dynloader/openbsd.h1
-rw-r--r--src/backend/port/win32/crashdump.c3
-rw-r--r--src/backend/postmaster/autovacuum.c1
-rw-r--r--src/backend/replication/basebackup.c1
-rw-r--r--src/backend/replication/logical/snapbuild.c1
-rw-r--r--src/backend/replication/walreceiverfuncs.c1
-rw-r--r--src/backend/storage/ipc/dsm.c1
-rw-r--r--src/backend/storage/ipc/dsm_impl.c1
-rw-r--r--src/backend/storage/ipc/latch.c1
-rw-r--r--src/backend/utils/adt/cash.c1
-rw-r--r--src/backend/utils/adt/dbsize.c1
-rw-r--r--src/backend/utils/adt/inet_cidr_ntop.c1
-rw-r--r--src/backend/utils/adt/inet_net_pton.c1
-rw-r--r--src/backend/utils/adt/pg_locale.c1
-rw-r--r--src/backend/utils/init/miscinit.c1
-rw-r--r--src/bin/initdb/initdb.c1
-rw-r--r--src/bin/pg_basebackup/pg_basebackup.c1
-rw-r--r--src/bin/pg_basebackup/pg_receivewal.c1
-rw-r--r--src/bin/pg_basebackup/streamutil.c3
-rw-r--r--src/bin/pg_ctl/pg_ctl.c11
-rw-r--r--src/bin/pg_dump/parallel.c14
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c16
-rw-r--r--src/bin/pg_dump/pg_dump.c3
-rw-r--r--src/bin/pg_dump/pg_dumpall.c4
-rw-r--r--src/bin/pg_dump/pg_restore.c15
-rw-r--r--src/bin/pg_resetwal/pg_resetwal.c1
-rw-r--r--src/bin/pg_rewind/copy_fetch.c2
-rw-r--r--src/bin/pg_rewind/fetch.c1
-rw-r--r--src/bin/pg_rewind/file_ops.c1
-rw-r--r--src/bin/pg_rewind/filemap.c1
-rw-r--r--src/bin/pg_rewind/libpq_fetch.c1
-rw-r--r--src/bin/pg_upgrade/dump.c1
-rw-r--r--src/bin/pg_upgrade/exec.c5
-rw-r--r--src/bin/pg_upgrade/option.c11
-rw-r--r--src/bin/pg_upgrade/parallel.c9
-rw-r--r--src/bin/pg_upgrade/tablespace.c2
-rw-r--r--src/bin/pgevent/pgevent.c6
-rw-r--r--src/bin/psql/command.c2
-rw-r--r--src/bin/psql/crosstabview.c2
-rw-r--r--src/bin/psql/help.c1
-rw-r--r--src/bin/psql/startup.c4
-rw-r--r--src/common/ip.c1
-rw-r--r--src/common/username.c2
-rw-r--r--src/common/wait_error.c2
-rw-r--r--src/fe_utils/print.c1
-rw-r--r--src/include/libpq/libpq.h1
-rw-r--r--src/include/port/atomics/generic-msvc.h1
-rw-r--r--src/include/utils/pg_locale.h1
-rw-r--r--src/interfaces/ecpg/ecpglib/data.c2
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c1
-rw-r--r--src/interfaces/ecpg/ecpglib/typename.c1
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c2
-rw-r--r--src/interfaces/ecpg/preproc/pgc.l1
-rw-r--r--src/interfaces/libpq/fe-connect.c1
-rw-r--r--src/interfaces/libpq/libpq-int.h1
-rw-r--r--src/interfaces/libpq/pthread-win32.c1
-rw-r--r--src/pl/plperl/plperl.c1
-rw-r--r--src/port/chklocale.c5
-rw-r--r--src/port/dirmod.c1
-rw-r--r--src/port/inet_net_ntop.c1
-rw-r--r--src/port/open.c1
-rw-r--r--src/port/system.c1
-rw-r--r--src/test/isolation/isolationtester.c3
-rw-r--r--src/timezone/strftime.c1
-rw-r--r--src/timezone/zic.c1
74 files changed, 34 insertions, 145 deletions
diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c
index c8240b112d..1fdc59190c 100644
--- a/src/backend/access/transam/timeline.c
+++ b/src/backend/access/transam/timeline.c
@@ -32,7 +32,6 @@
#include "postgres.h"
#include <sys/stat.h>
-#include <stdio.h>
#include <unistd.h>
#include "access/timeline.h"
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 50c70b2920..0a8edb9e58 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -54,7 +54,6 @@
#include <fcntl.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <time.h>
#include <unistd.h>
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c
index 7e91e8f81a..7afb73579b 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -14,7 +14,6 @@
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <signal.h>
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 1ebacbc24f..5a63b1abcb 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -20,7 +20,6 @@
#include "postgres.h"
#include <fcntl.h>
-#include <locale.h>
#include <unistd.h>
#include <sys/stat.h>
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 80515bae19..f9c26201d9 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -48,7 +48,6 @@
#include <unistd.h>
#include <dirent.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include "access/heapam.h"
diff --git a/src/backend/libpq/ifaddr.c b/src/backend/libpq/ifaddr.c
index 7692881c8b..f81003f7c8 100644
--- a/src/backend/libpq/ifaddr.c
+++ b/src/backend/libpq/ifaddr.c
@@ -20,7 +20,6 @@
#include "postgres.h"
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netdb.h>
diff --git a/src/backend/port/atomics.c b/src/backend/port/atomics.c
index 86b5308214..756a2ef997 100644
--- a/src/backend/port/atomics.c
+++ b/src/backend/port/atomics.c
@@ -21,7 +21,6 @@
#ifdef WIN32
#error "barriers are required (and provided) on WIN32 platforms"
#endif
-#include <sys/types.h>
#include <signal.h>
#endif
diff --git a/src/backend/port/dynloader/freebsd.h b/src/backend/port/dynloader/freebsd.h
index 78dda69922..6116d3f83f 100644
--- a/src/backend/port/dynloader/freebsd.h
+++ b/src/backend/port/dynloader/freebsd.h
@@ -13,7 +13,6 @@
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
-#include <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
diff --git a/src/backend/port/dynloader/netbsd.h b/src/backend/port/dynloader/netbsd.h
index 688b7fb793..0bd406850d 100644
--- a/src/backend/port/dynloader/netbsd.h
+++ b/src/backend/port/dynloader/netbsd.h
@@ -14,7 +14,6 @@
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
-#include <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
diff --git a/src/backend/port/dynloader/openbsd.h b/src/backend/port/dynloader/openbsd.h
index 34d2724615..25d5439633 100644
--- a/src/backend/port/dynloader/openbsd.h
+++ b/src/backend/port/dynloader/openbsd.h
@@ -13,7 +13,6 @@
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
-#include <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
diff --git a/src/backend/port/win32/crashdump.c b/src/backend/port/win32/crashdump.c
index 64969df73d..ff44b6033e 100644
--- a/src/backend/port/win32/crashdump.c
+++ b/src/backend/port/win32/crashdump.c
@@ -39,8 +39,7 @@
#include "postgres.h"
#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <string.h>
+
/*
* Some versions of the MS SDK contain "typedef enum { ... } ;" which the MS
* compiler quite sanely complains about. Well done, Microsoft.
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 0c5ffa086c..e8de9a3ced 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -62,7 +62,6 @@
#include "postgres.h"
#include <signal.h>
-#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 643a17943a..7414048f4e 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -12,7 +12,6 @@
*/
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index c0f28ddc09..6f19cdca8c 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -107,7 +107,6 @@
#include "postgres.h"
#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#include "miscadmin.h"
diff --git a/src/backend/replication/walreceiverfuncs.c b/src/backend/replication/walreceiverfuncs.c
index df113b86e8..8bf1fe8565 100644
--- a/src/backend/replication/walreceiverfuncs.c
+++ b/src/backend/replication/walreceiverfuncs.c
@@ -16,7 +16,6 @@
*/
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
diff --git a/src/backend/storage/ipc/dsm.c b/src/backend/storage/ipc/dsm.c
index 07af16622c..54378bcea9 100644
--- a/src/backend/storage/ipc/dsm.c
+++ b/src/backend/storage/ipc/dsm.c
@@ -27,7 +27,6 @@
#include "postgres.h"
#include <fcntl.h>
-#include <string.h>
#include <unistd.h>
#ifndef WIN32
#include <sys/mman.h>
diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/dsm_impl.c
index 7078f68c35..b2c9cdc6ed 100644
--- a/src/backend/storage/ipc/dsm_impl.c
+++ b/src/backend/storage/ipc/dsm_impl.c
@@ -49,7 +49,6 @@
#include "postgres.h"
#include <fcntl.h>
-#include <string.h>
#include <unistd.h>
#ifndef WIN32
#include <sys/mman.h>
diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c
index 0079ba567f..ea7f930866 100644
--- a/src/backend/storage/ipc/latch.c
+++ b/src/backend/storage/ipc/latch.c
@@ -40,7 +40,6 @@
#include <signal.h>
#include <unistd.h>
#include <sys/time.h>
-#include <sys/types.h>
#ifdef HAVE_SYS_EPOLL_H
#include <sys/epoll.h>
#endif
diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c
index ac8f74fee6..5afadb65d1 100644
--- a/src/backend/utils/adt/cash.c
+++ b/src/backend/utils/adt/cash.c
@@ -21,7 +21,6 @@
#include <limits.h>
#include <ctype.h>
#include <math.h>
-#include <locale.h>
#include "libpq/pqformat.h"
#include "utils/builtins.h"
diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c
index ec3a28cd0d..8cdd1dc4f7 100644
--- a/src/backend/utils/adt/dbsize.c
+++ b/src/backend/utils/adt/dbsize.c
@@ -11,7 +11,6 @@
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include "access/heapam.h"
diff --git a/src/backend/utils/adt/inet_cidr_ntop.c b/src/backend/utils/adt/inet_cidr_ntop.c
index d33534ec17..d5d1289d7d 100644
--- a/src/backend/utils/adt/inet_cidr_ntop.c
+++ b/src/backend/utils/adt/inet_cidr_ntop.c
@@ -23,7 +23,6 @@ static const char rcsid[] = "Id: inet_net_ntop.c,v 1.1.2.2 2004/03/09 09:17:27 m
#include "postgres.h"
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/src/backend/utils/adt/inet_net_pton.c b/src/backend/utils/adt/inet_net_pton.c
index b8fa7d2bcc..be788d37cd 100644
--- a/src/backend/utils/adt/inet_net_pton.c
+++ b/src/backend/utils/adt/inet_net_pton.c
@@ -23,7 +23,6 @@ static const char rcsid[] = "Id: inet_net_pton.c,v 1.4.2.3 2004/03/17 00:40:11 m
#include "postgres.h"
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 4c7f1dad50..ab197025f8 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -51,7 +51,6 @@
#include "postgres.h"
-#include <locale.h>
#include <time.h>
#include "access/htup_details.h"
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index e984e79c60..e0298ee35f 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -20,7 +20,6 @@
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/time.h>
-#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <grp.h>
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 540427a892..1ed0d20504 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -52,7 +52,6 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <locale.h>
#include <signal.h>
#include <time.h>
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 9020fb14d3..bc997dc997 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -16,7 +16,6 @@
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <time.h>
diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c
index e8d0e8984e..15348ada58 100644
--- a/src/bin/pg_basebackup/pg_receivewal.c
+++ b/src/bin/pg_basebackup/pg_receivewal.c
@@ -17,7 +17,6 @@
#include <dirent.h>
#include <signal.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#include "libpq-fe.h"
diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c
index 90d93cbed1..1fe42efc21 100644
--- a/src/bin/pg_basebackup/streamutil.c
+++ b/src/bin/pg_basebackup/streamutil.c
@@ -13,10 +13,7 @@
#include "postgres_fe.h"
-#include <stdio.h>
-#include <string.h>
#include <sys/time.h>
-#include <sys/types.h>
#include <unistd.h>
/* for ntohl/htonl */
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 93e5891950..c63819b88b 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -19,16 +19,9 @@
#include "postgres_fe.h"
-#include "catalog/pg_control.h"
-#include "common/controldata_utils.h"
-#include "libpq-fe.h"
-#include "pqexpbuffer.h"
-
#include <fcntl.h>
-#include <locale.h>
#include <signal.h>
#include <time.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -38,8 +31,12 @@
#include <sys/resource.h>
#endif
+#include "catalog/pg_control.h"
+#include "common/controldata_utils.h"
#include "getopt_long.h"
+#include "libpq-fe.h"
#include "miscadmin.h"
+#include "pqexpbuffer.h"
/* PID can be negative for standalone backend */
typedef long pgpid_t;
diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c
index 775a7f858c..be8e018a96 100644
--- a/src/bin/pg_dump/parallel.c
+++ b/src/bin/pg_dump/parallel.c
@@ -51,6 +51,12 @@
#include "postgres_fe.h"
+#ifndef WIN32
+#include <sys/wait.h>
+#include <signal.h>
+#include <unistd.h>
+#include <fcntl.h>
+#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
@@ -59,14 +65,6 @@
#include "pg_backup_utils.h"
#include "fe_utils/string_utils.h"
-#ifndef WIN32
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "signal.h"
-#include <unistd.h>
-#include <fcntl.h>
-#endif
-
/* Mnemonic macros for indexing the fd array returned by pipe(2) */
#define PIPE_READ 0
#define PIPE_WRITE 1
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 929f1b592b..7e2bed38b3 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -21,24 +21,22 @@
*/
#include "postgres_fe.h"
-#include "parallel.h"
-#include "pg_backup_archiver.h"
-#include "pg_backup_db.h"
-#include "pg_backup_utils.h"
-#include "dumputils.h"
-#include "fe_utils/string_utils.h"
-
#include <ctype.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/wait.h>
-
#ifdef WIN32
#include <io.h>
#endif
+#include "parallel.h"
+#include "pg_backup_archiver.h"
+#include "pg_backup_db.h"
+#include "pg_backup_utils.h"
+#include "dumputils.h"
+#include "fe_utils/string_utils.h"
+
#include "libpq/libpq-fs.h"
#define TEXT_DUMP_HEADER "--\n-- PostgreSQL database dump\n--\n\n"
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 89db3103bc..7273ec8fe2 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -33,9 +33,6 @@
#include <unistd.h>
#include <ctype.h>
-#ifdef ENABLE_NLS
-#include <locale.h>
-#endif
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 6895d02bfc..f4b4d7bd9b 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -18,10 +18,6 @@
#include <time.h>
#include <unistd.h>
-#ifdef ENABLE_NLS
-#include <locale.h>
-#endif
-
#include "getopt_long.h"
#include "dumputils.h"
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index 497677494b..5f61fb2764 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -40,21 +40,16 @@
*/
#include "postgres_fe.h"
-#include "getopt_long.h"
-
-#include "dumputils.h"
-#include "parallel.h"
-#include "pg_backup_utils.h"
-
#include <ctype.h>
-
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
-#ifdef ENABLE_NLS
-#include <locale.h>
-#endif
+#include "getopt_long.h"
+
+#include "dumputils.h"
+#include "parallel.h"
+#include "pg_backup_utils.h"
static void usage(const char *progname);
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
index 502ea5b290..27bd9b04e7 100644
--- a/src/bin/pg_resetwal/pg_resetwal.c
+++ b/src/bin/pg_resetwal/pg_resetwal.c
@@ -39,7 +39,6 @@
#include <dirent.h>
#include <fcntl.h>
-#include <locale.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
diff --git a/src/bin/pg_rewind/copy_fetch.c b/src/bin/pg_rewind/copy_fetch.c
index d48424bfb4..f8d3dfecfa 100644
--- a/src/bin/pg_rewind/copy_fetch.c
+++ b/src/bin/pg_rewind/copy_fetch.c
@@ -9,12 +9,10 @@
*/
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
-#include <string.h>
#include "datapagemap.h"
#include "fetch.h"
diff --git a/src/bin/pg_rewind/fetch.c b/src/bin/pg_rewind/fetch.c
index 08a296d7d4..e9353d8866 100644
--- a/src/bin/pg_rewind/fetch.c
+++ b/src/bin/pg_rewind/fetch.c
@@ -16,7 +16,6 @@
*/
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/src/bin/pg_rewind/file_ops.c b/src/bin/pg_rewind/file_ops.c
index f8ca4c925d..4229f0e056 100644
--- a/src/bin/pg_rewind/file_ops.c
+++ b/src/bin/pg_rewind/file_ops.c
@@ -14,7 +14,6 @@
*/
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
index 151930234c..e5b254069d 100644
--- a/src/bin/pg_rewind/filemap.c
+++ b/src/bin/pg_rewind/filemap.c
@@ -10,7 +10,6 @@
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.c
index d2374201c6..d86ecd3660 100644
--- a/src/bin/pg_rewind/libpq_fetch.c
+++ b/src/bin/pg_rewind/libpq_fetch.c
@@ -9,7 +9,6 @@
*/
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c
index f18be22c16..2e621b027c 100644
--- a/src/bin/pg_upgrade/dump.c
+++ b/src/bin/pg_upgrade/dump.c
@@ -11,7 +11,6 @@
#include "pg_upgrade.h"
-#include <sys/types.h>
#include "fe_utils/string_utils.h"
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index b6a3ef791e..91fa71728e 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -9,10 +9,9 @@
#include "postgres_fe.h"
-#include "pg_upgrade.h"
-
#include <fcntl.h>
-#include <sys/types.h>
+
+#include "pg_upgrade.h"
static void check_data_dir(ClusterInfo *cluster);
static void check_bin_dir(ClusterInfo *cluster);
diff --git a/src/bin/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c
index 82d2443bcd..5007ce53cf 100644
--- a/src/bin/pg_upgrade/option.c
+++ b/src/bin/pg_upgrade/option.c
@@ -9,17 +9,16 @@
#include "postgres_fe.h"
-#include "miscadmin.h"
-#include "getopt_long.h"
-
-#include "pg_upgrade.h"
-
#include <time.h>
-#include <sys/types.h>
#ifdef WIN32
#include <io.h>
#endif
+#include "miscadmin.h"
+#include "getopt_long.h"
+
+#include "pg_upgrade.h"
+
static void usage(void);
static void check_required_directory(char **dirpath, char **configpath,
diff --git a/src/bin/pg_upgrade/parallel.c b/src/bin/pg_upgrade/parallel.c
index d35015f52a..7c85a13a99 100644
--- a/src/bin/pg_upgrade/parallel.c
+++ b/src/bin/pg_upgrade/parallel.c
@@ -9,17 +9,14 @@
#include "postgres_fe.h"
-#include "pg_upgrade.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
#include <sys/wait.h>
-
#ifdef WIN32
#include <io.h>
#endif
+#include "pg_upgrade.h"
+
+
static int parallel_jobs;
#ifdef WIN32
diff --git a/src/bin/pg_upgrade/tablespace.c b/src/bin/pg_upgrade/tablespace.c
index 24f7bd960c..4938bc2de2 100644
--- a/src/bin/pg_upgrade/tablespace.c
+++ b/src/bin/pg_upgrade/tablespace.c
@@ -11,8 +11,6 @@
#include "pg_upgrade.h"
-#include <sys/types.h>
-
static void get_tablespace_paths(void);
static void set_tablespace_directory_suffix(ClusterInfo *cluster);
diff --git a/src/bin/pgevent/pgevent.c b/src/bin/pgevent/pgevent.c
index 5332a13256..f68f987c17 100644
--- a/src/bin/pgevent/pgevent.c
+++ b/src/bin/pgevent/pgevent.c
@@ -10,15 +10,9 @@
*
*-------------------------------------------------------------------------
*/
-
-
#include "postgres_fe.h"
-#include <windows.h>
#include <olectl.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
/* Global variables */
HANDLE g_module = NULL; /* hModule of DLL */
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index f17f610717..a28f5134b9 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -18,7 +18,6 @@
#include <pwd.h>
#endif
#ifndef WIN32
-#include <sys/types.h> /* for umask() */
#include <sys/stat.h> /* for stat() */
#include <fcntl.h> /* open() flags */
#include <unistd.h> /* for geteuid(), getpid(), stat() */
@@ -27,7 +26,6 @@
#include <io.h>
#include <fcntl.h>
#include <direct.h>
-#include <sys/types.h> /* for umask() */
#include <sys/stat.h> /* for stat() */
#endif
diff --git a/src/bin/psql/crosstabview.c b/src/bin/psql/crosstabview.c
index bf48d2f406..2794eb6b87 100644
--- a/src/bin/psql/crosstabview.c
+++ b/src/bin/psql/crosstabview.c
@@ -7,8 +7,6 @@
*/
#include "postgres_fe.h"
-#include <string.h>
-
#include "common.h"
#include "crosstabview.h"
#include "pqexpbuffer.h"
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 3e3cab4941..91cf0be46a 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -8,7 +8,6 @@
#include "postgres_fe.h"
#ifndef WIN32
-#include <sys/types.h> /* (ditto) */
#include <unistd.h> /* for geteuid() */
#else
#include <win32.h>
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 88d686a5b7..694f0ef257 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -7,8 +7,6 @@
*/
#include "postgres_fe.h"
-#include <sys/types.h>
-
#ifndef WIN32
#include <unistd.h>
#else /* WIN32 */
@@ -18,8 +16,6 @@
#include "getopt_long.h"
-#include <locale.h>
-
#include "command.h"
#include "common.h"
#include "describe.h"
diff --git a/src/common/ip.c b/src/common/ip.c
index d981dbcac9..80711dbb98 100644
--- a/src/common/ip.c
+++ b/src/common/ip.c
@@ -24,7 +24,6 @@
#endif
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netdb.h>
diff --git a/src/common/username.c b/src/common/username.c
index d6abac8281..487eacfe73 100644
--- a/src/common/username.c
+++ b/src/common/username.c
@@ -18,10 +18,8 @@
#include "postgres_fe.h"
#endif
-#include <errno.h>
#include <pwd.h>
#include <unistd.h>
-#include <sys/types.h>
#include "common/username.h"
diff --git a/src/common/wait_error.c b/src/common/wait_error.c
index 7ac545c67a..f824a5f2af 100644
--- a/src/common/wait_error.c
+++ b/src/common/wait_error.c
@@ -21,8 +21,6 @@
#endif
#include <signal.h>
-#include <stdio.h>
-#include <string.h>
#include <sys/wait.h>
/*
diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c
index 5ca27a93e0..9180b90004 100644
--- a/src/fe_utils/print.c
+++ b/src/fe_utils/print.c
@@ -18,7 +18,6 @@
#include "postgres_fe.h"
#include <limits.h>
-#include <locale.h>
#include <math.h>
#include <signal.h>
#include <unistd.h>
diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h
index 538066e106..d4885a5e28 100644
--- a/src/include/libpq/libpq.h
+++ b/src/include/libpq/libpq.h
@@ -14,7 +14,6 @@
#ifndef LIBPQ_H
#define LIBPQ_H
-#include <sys/types.h>
#include <netinet/in.h>
#include "lib/stringinfo.h"
diff --git a/src/include/port/atomics/generic-msvc.h b/src/include/port/atomics/generic-msvc.h
index c7caf04d57..d5ee6e1bcb 100644
--- a/src/include/port/atomics/generic-msvc.h
+++ b/src/include/port/atomics/generic-msvc.h
@@ -17,7 +17,6 @@
*-------------------------------------------------------------------------
*/
#include <intrin.h>
-#include <windows.h>
/* intentionally no include guards, should only be included by atomics.h */
#ifndef INSIDE_ATOMICS_H
diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h
index be91f9b88c..cb509e2b6b 100644
--- a/src/include/utils/pg_locale.h
+++ b/src/include/utils/pg_locale.h
@@ -12,7 +12,6 @@
#ifndef _PG_LOCALE_
#define _PG_LOCALE_
-#include <locale.h>
#if defined(LOCALE_T_IN_XLOCALE) || defined(WCSTOMBS_L_IN_XLOCALE)
#include <xlocale.h>
#endif
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index 23646a9579..499a4c1780 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -3,8 +3,6 @@
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
-#include <stdlib.h>
-#include <string.h>
#include <float.h>
#include <math.h>
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index d5a463d940..bd9b86be49 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -16,7 +16,6 @@
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
-#include <locale.h>
#include <float.h>
#include <math.h>
diff --git a/src/interfaces/ecpg/ecpglib/typename.c b/src/interfaces/ecpg/ecpglib/typename.c
index db65ec10f1..f90279cf81 100644
--- a/src/interfaces/ecpg/ecpglib/typename.c
+++ b/src/interfaces/ecpg/ecpglib/typename.c
@@ -3,7 +3,6 @@
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
-#include <stdlib.h>
#include "ecpgtype.h"
#include "ecpglib.h"
#include "extern.h"
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index fa80bb289e..aaecbf8122 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -6,7 +6,7 @@
#include "postgres_fe.h"
#include <unistd.h>
-#include <string.h>
+
#include "getopt_long.h"
#include "extern.h"
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index b894a33e53..6b58dd5afe 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -19,7 +19,6 @@
#include "postgres_fe.h"
#include <ctype.h>
-#include <sys/types.h>
#include <limits.h>
#include "extern.h"
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 65b7c31dc0..685f355ab3 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -15,7 +15,6 @@
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h
index e9b73a925e..24242da221 100644
--- a/src/interfaces/libpq/libpq-int.h
+++ b/src/interfaces/libpq/libpq-int.h
@@ -25,7 +25,6 @@
#include "libpq-events.h"
#include <time.h>
-#include <sys/types.h>
#ifndef WIN32
#include <sys/time.h>
#endif
diff --git a/src/interfaces/libpq/pthread-win32.c b/src/interfaces/libpq/pthread-win32.c
index e63432d822..0e0d3eeb88 100644
--- a/src/interfaces/libpq/pthread-win32.c
+++ b/src/interfaces/libpq/pthread-win32.c
@@ -12,7 +12,6 @@
#include "postgres_fe.h"
-#include <windows.h>
#include "pthread-win32.h"
DWORD
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index fc10d30f45..00979cba74 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -13,7 +13,6 @@
#include <ctype.h>
#include <fcntl.h>
#include <limits.h>
-#include <locale.h>
#include <unistd.h>
/* postgreSQL stuff */
diff --git a/src/port/chklocale.c b/src/port/chklocale.c
index 54ce9410f0..c6ec929702 100644
--- a/src/port/chklocale.c
+++ b/src/port/chklocale.c
@@ -19,11 +19,6 @@
#include "postgres_fe.h"
#endif
-#if defined(WIN32) && (_MSC_VER >= 1900)
-#include <windows.h>
-#endif
-
-#include <locale.h>
#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
#endif
diff --git a/src/port/dirmod.c b/src/port/dirmod.c
index 08835962be..84039ff38a 100644
--- a/src/port/dirmod.c
+++ b/src/port/dirmod.c
@@ -34,7 +34,6 @@
#ifndef __CYGWIN__
#include <winioctl.h>
#else
-#include <windows.h>
#include <w32api/winioctl.h>
#endif
#endif
diff --git a/src/port/inet_net_ntop.c b/src/port/inet_net_ntop.c
index 047895e4f4..cebcda0e61 100644
--- a/src/port/inet_net_ntop.c
+++ b/src/port/inet_net_ntop.c
@@ -27,7 +27,6 @@ static const char rcsid[] = "Id: inet_net_ntop.c,v 1.1.2.2 2004/03/09 09:17:27 m
#include "postgres_fe.h"
#endif
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/src/port/open.c b/src/port/open.c
index db7abdbe03..aa31342261 100644
--- a/src/port/open.c
+++ b/src/port/open.c
@@ -19,7 +19,6 @@
#include "postgres_fe.h"
#endif
-#include <windows.h>
#include <fcntl.h>
#include <assert.h>
diff --git a/src/port/system.c b/src/port/system.c
index 8651187890..3d99c7985f 100644
--- a/src/port/system.c
+++ b/src/port/system.c
@@ -44,7 +44,6 @@
#include "postgres_fe.h"
#endif
-#include <windows.h>
#include <fcntl.h>
#undef system
diff --git a/src/test/isolation/isolationtester.c b/src/test/isolation/isolationtester.c
index db2b55982b..f77f465751 100644
--- a/src/test/isolation/isolationtester.c
+++ b/src/test/isolation/isolationtester.c
@@ -7,9 +7,6 @@
#include "postgres_fe.h"
-#ifdef WIN32
-#include <windows.h>
-#endif
#include <sys/time.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
diff --git a/src/timezone/strftime.c b/src/timezone/strftime.c
index 4a0a01db65..acaba86881 100644
--- a/src/timezone/strftime.c
+++ b/src/timezone/strftime.c
@@ -41,7 +41,6 @@
#include "postgres.h"
#include <fcntl.h>
-#include <locale.h>
#include "private.h"
#include "tzfile.h"
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index a83cea12dd..e1875585df 100644
--- a/src/timezone/zic.c
+++ b/src/timezone/zic.c
@@ -9,7 +9,6 @@
#include "postgres_fe.h"
#include <fcntl.h>
-#include <locale.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>