From 6dd78caf22aba4ac57bca2edd8bc09bdd467413f Mon Sep 17 00:00:00 2001
From: Richard Guo <guofenglinux@gmail.com>
Date: Tue, 12 Mar 2024 17:27:08 +0800
Subject: [PATCH v2 2/2] Make the order of the header file includes consistent
 in non-backend modules

---
 contrib/pageinspect/gistfuncs.c                          | 2 +-
 contrib/postgres_fdw/deparse.c                           | 2 +-
 contrib/uuid-ossp/uuid-ossp.c                            | 2 +-
 src/bin/pg_basebackup/bbstreamer_file.c                  | 2 +-
 src/bin/pg_basebackup/bbstreamer_gzip.c                  | 2 +-
 src/bin/pg_basebackup/bbstreamer_lz4.c                   | 2 +-
 src/bin/pg_combinebackup/backup_label.c                  | 2 +-
 src/bin/pg_combinebackup/pg_combinebackup.c              | 2 +-
 src/bin/pg_combinebackup/reconstruct.c                   | 2 +-
 src/bin/pg_dump/compress_lz4.c                           | 2 +-
 src/bin/pg_dump/compress_zstd.c                          | 2 +-
 src/bin/pg_upgrade/controldata.c                         | 2 +-
 src/bin/pg_walsummary/pg_walsummary.c                    | 2 +-
 src/interfaces/ecpg/test/pg_regress_ecpg.c               | 2 +-
 src/pl/plpython/plpy_procedure.c                         | 2 +-
 src/test/modules/injection_points/injection_points.c     | 2 +-
 src/test/modules/ldap_password_func/ldap_password_func.c | 2 +-
 src/test/modules/test_dsa/test_dsa.c                     | 2 +-
 src/test/modules/worker_spi/worker_spi.c                 | 2 +-
 19 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/contrib/pageinspect/gistfuncs.c b/contrib/pageinspect/gistfuncs.c
index 8a81038bcb..b38f1d32f7 100644
--- a/contrib/pageinspect/gistfuncs.c
+++ b/contrib/pageinspect/gistfuncs.c
@@ -21,8 +21,8 @@
 #include "storage/itemptr.h"
 #include "utils/array.h"
 #include "utils/builtins.h"
-#include "utils/pg_lsn.h"
 #include "utils/lsyscache.h"
+#include "utils/pg_lsn.h"
 #include "utils/rel.h"
 #include "utils/ruleutils.h"
 #include "utils/varlena.h"
diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c
index 8787c00d3e..ce765ecc90 100644
--- a/contrib/postgres_fdw/deparse.c
+++ b/contrib/postgres_fdw/deparse.c
@@ -47,6 +47,7 @@
 #include "catalog/pg_ts_dict.h"
 #include "catalog/pg_type.h"
 #include "commands/defrem.h"
+#include "commands/tablecmds.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "nodes/plannodes.h"
@@ -60,7 +61,6 @@
 #include "utils/rel.h"
 #include "utils/syscache.h"
 #include "utils/typcache.h"
-#include "commands/tablecmds.h"
 
 /*
  * Global context for foreign_expr_walker's search of an expression tree.
diff --git a/contrib/uuid-ossp/uuid-ossp.c b/contrib/uuid-ossp/uuid-ossp.c
index ee5d785cad..3172714eb6 100644
--- a/contrib/uuid-ossp/uuid-ossp.c
+++ b/contrib/uuid-ossp/uuid-ossp.c
@@ -13,9 +13,9 @@
 
 #include "postgres.h"
 
-#include "fmgr.h"
 #include "common/cryptohash.h"
 #include "common/sha1.h"
+#include "fmgr.h"
 #include "port/pg_bswap.h"
 #include "utils/builtins.h"
 #include "utils/uuid.h"
diff --git a/src/bin/pg_basebackup/bbstreamer_file.c b/src/bin/pg_basebackup/bbstreamer_file.c
index fd89012487..0be39dddc9 100644
--- a/src/bin/pg_basebackup/bbstreamer_file.c
+++ b/src/bin/pg_basebackup/bbstreamer_file.c
@@ -14,8 +14,8 @@
 #include <unistd.h>
 
 #include "bbstreamer.h"
-#include "common/logging.h"
 #include "common/file_perm.h"
+#include "common/logging.h"
 #include "common/string.h"
 
 typedef struct bbstreamer_plain_writer
diff --git a/src/bin/pg_basebackup/bbstreamer_gzip.c b/src/bin/pg_basebackup/bbstreamer_gzip.c
index 2fd704031d..4659314afd 100644
--- a/src/bin/pg_basebackup/bbstreamer_gzip.c
+++ b/src/bin/pg_basebackup/bbstreamer_gzip.c
@@ -18,8 +18,8 @@
 #endif
 
 #include "bbstreamer.h"
-#include "common/logging.h"
 #include "common/file_perm.h"
+#include "common/logging.h"
 #include "common/string.h"
 
 #ifdef HAVE_LIBZ
diff --git a/src/bin/pg_basebackup/bbstreamer_lz4.c b/src/bin/pg_basebackup/bbstreamer_lz4.c
index ab1209fd1a..eda62caede 100644
--- a/src/bin/pg_basebackup/bbstreamer_lz4.c
+++ b/src/bin/pg_basebackup/bbstreamer_lz4.c
@@ -18,8 +18,8 @@
 #endif
 
 #include "bbstreamer.h"
-#include "common/logging.h"
 #include "common/file_perm.h"
+#include "common/logging.h"
 #include "common/string.h"
 
 #ifdef USE_LZ4
diff --git a/src/bin/pg_combinebackup/backup_label.c b/src/bin/pg_combinebackup/backup_label.c
index 9c1a6e2db2..b962927e70 100644
--- a/src/bin/pg_combinebackup/backup_label.c
+++ b/src/bin/pg_combinebackup/backup_label.c
@@ -15,8 +15,8 @@
 
 #include "access/xlogdefs.h"
 #include "backup_label.h"
-#include "common/logging.h"
 #include "common/file_perm.h"
+#include "common/logging.h"
 #include "write_manifest.h"
 
 static int	get_eol_offset(StringInfo buf);
diff --git a/src/bin/pg_combinebackup/pg_combinebackup.c b/src/bin/pg_combinebackup/pg_combinebackup.c
index 31ead7f405..860d8d3a26 100644
--- a/src/bin/pg_combinebackup/pg_combinebackup.c
+++ b/src/bin/pg_combinebackup/pg_combinebackup.c
@@ -25,9 +25,9 @@
 #include "common/logging.h"
 #include "copy_file.h"
 #include "fe_utils/option_utils.h"
+#include "getopt_long.h"
 #include "lib/stringinfo.h"
 #include "load_manifest.h"
-#include "getopt_long.h"
 #include "reconstruct.h"
 #include "write_manifest.h"
 
diff --git a/src/bin/pg_combinebackup/reconstruct.c b/src/bin/pg_combinebackup/reconstruct.c
index 873d307902..f5db1f2377 100644
--- a/src/bin/pg_combinebackup/reconstruct.c
+++ b/src/bin/pg_combinebackup/reconstruct.c
@@ -15,8 +15,8 @@
 #include <unistd.h>
 
 #include "backup/basebackup_incremental.h"
-#include "common/logging.h"
 #include "common/file_perm.h"
+#include "common/logging.h"
 #include "copy_file.h"
 #include "lib/stringinfo.h"
 #include "reconstruct.h"
diff --git a/src/bin/pg_dump/compress_lz4.c b/src/bin/pg_dump/compress_lz4.c
index 8a01d31f74..7f72492bea 100644
--- a/src/bin/pg_dump/compress_lz4.c
+++ b/src/bin/pg_dump/compress_lz4.c
@@ -12,9 +12,9 @@
  *-------------------------------------------------------------------------
  */
 #include "postgres_fe.h"
-#include "pg_backup_utils.h"
 
 #include "compress_lz4.h"
+#include "pg_backup_utils.h"
 
 #ifdef USE_LZ4
 #include <lz4frame.h>
diff --git a/src/bin/pg_dump/compress_zstd.c b/src/bin/pg_dump/compress_zstd.c
index d6a3bb68ba..aa5aff2fee 100644
--- a/src/bin/pg_dump/compress_zstd.c
+++ b/src/bin/pg_dump/compress_zstd.c
@@ -14,8 +14,8 @@
 
 #include "postgres_fe.h"
 
-#include "pg_backup_utils.h"
 #include "compress_zstd.h"
+#include "pg_backup_utils.h"
 
 #ifndef USE_ZSTD
 
diff --git a/src/bin/pg_upgrade/controldata.c b/src/bin/pg_upgrade/controldata.c
index 3c836c7c13..1f0ccea3ed 100644
--- a/src/bin/pg_upgrade/controldata.c
+++ b/src/bin/pg_upgrade/controldata.c
@@ -11,8 +11,8 @@
 
 #include <ctype.h>
 
-#include "pg_upgrade.h"
 #include "common/string.h"
+#include "pg_upgrade.h"
 
 
 /*
diff --git a/src/bin/pg_walsummary/pg_walsummary.c b/src/bin/pg_walsummary/pg_walsummary.c
index 485c72d939..5e41b376d7 100644
--- a/src/bin/pg_walsummary/pg_walsummary.c
+++ b/src/bin/pg_walsummary/pg_walsummary.c
@@ -19,8 +19,8 @@
 #include "common/int.h"
 #include "common/logging.h"
 #include "fe_utils/option_utils.h"
-#include "lib/stringinfo.h"
 #include "getopt_long.h"
+#include "lib/stringinfo.h"
 
 typedef struct ws_options
 {
diff --git a/src/interfaces/ecpg/test/pg_regress_ecpg.c b/src/interfaces/ecpg/test/pg_regress_ecpg.c
index 644fc64068..c9960b8d20 100644
--- a/src/interfaces/ecpg/test/pg_regress_ecpg.c
+++ b/src/interfaces/ecpg/test/pg_regress_ecpg.c
@@ -18,9 +18,9 @@
 
 #include "postgres_fe.h"
 
-#include "pg_regress.h"
 #include "common/string.h"
 #include "lib/stringinfo.h"
+#include "pg_regress.h"
 
 
 /*
diff --git a/src/pl/plpython/plpy_procedure.c b/src/pl/plpython/plpy_procedure.c
index 79b6ef6a44..9cbbe7e3c8 100644
--- a/src/pl/plpython/plpy_procedure.c
+++ b/src/pl/plpython/plpy_procedure.c
@@ -8,9 +8,9 @@
 
 #include "access/htup_details.h"
 #include "access/transam.h"
-#include "funcapi.h"
 #include "catalog/pg_proc.h"
 #include "catalog/pg_type.h"
+#include "funcapi.h"
 #include "plpy_elog.h"
 #include "plpy_main.h"
 #include "plpy_procedure.h"
diff --git a/src/test/modules/injection_points/injection_points.c b/src/test/modules/injection_points/injection_points.c
index 7f52d758c5..0730254d54 100644
--- a/src/test/modules/injection_points/injection_points.c
+++ b/src/test/modules/injection_points/injection_points.c
@@ -19,9 +19,9 @@
 
 #include "fmgr.h"
 #include "storage/condition_variable.h"
+#include "storage/dsm_registry.h"
 #include "storage/lwlock.h"
 #include "storage/shmem.h"
-#include "storage/dsm_registry.h"
 #include "utils/builtins.h"
 #include "utils/injection_point.h"
 #include "utils/wait_event.h"
diff --git a/src/test/modules/ldap_password_func/ldap_password_func.c b/src/test/modules/ldap_password_func/ldap_password_func.c
index f3d7994738..99c18a8f1c 100644
--- a/src/test/modules/ldap_password_func/ldap_password_func.c
+++ b/src/test/modules/ldap_password_func/ldap_password_func.c
@@ -15,9 +15,9 @@
 #include <float.h>
 #include <stdio.h>
 
+#include "libpq/auth.h"
 #include "libpq/libpq.h"
 #include "libpq/libpq-be.h"
-#include "libpq/auth.h"
 #include "utils/guc.h"
 
 PG_MODULE_MAGIC;
diff --git a/src/test/modules/test_dsa/test_dsa.c b/src/test/modules/test_dsa/test_dsa.c
index 844316dec2..c78af68f61 100644
--- a/src/test/modules/test_dsa/test_dsa.c
+++ b/src/test/modules/test_dsa/test_dsa.c
@@ -13,8 +13,8 @@
 #include "postgres.h"
 
 #include "fmgr.h"
-#include "utils/dsa.h"
 #include "storage/lwlock.h"
+#include "utils/dsa.h"
 #include "utils/resowner.h"
 
 PG_MODULE_MAGIC;
diff --git a/src/test/modules/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c
index 770e87ae47..22177cf2b5 100644
--- a/src/test/modules/worker_spi/worker_spi.c
+++ b/src/test/modules/worker_spi/worker_spi.c
@@ -39,10 +39,10 @@
 #include "fmgr.h"
 #include "lib/stringinfo.h"
 #include "pgstat.h"
+#include "tcop/utility.h"
 #include "utils/acl.h"
 #include "utils/builtins.h"
 #include "utils/snapmgr.h"
-#include "tcop/utility.h"
 
 PG_MODULE_MAGIC;
 
-- 
2.31.0

