From 9722bb5757c5e90617be685bf127911b63efe08d Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Wed, 8 Mar 2017 20:41:06 -0500
Subject: [PATCH] Fix inclusions of postgres_fe.h from .h files.

We have a project policy that every .c file should start by including
postgres.h, postgres_fe.h, or c.h as appropriate; and then there is no
need for any .h file to explicitly include any of these.  Fix a few
headers that were violating this policy by including postgres_fe.h.

Discussion: https://postgr.es/m/CAEepm=2zCoeq3QxVwhS5DFeUh=yU6z81pbWMgfOB8OzyiBwxzw@mail.gmail.com
Discussion: https://postgr.es/m/11634.1488932128@sss.pgh.pa.us
---
 src/interfaces/ecpg/ecpglib/extern.h       | 2 +-
 src/interfaces/ecpg/test/pg_regress_ecpg.c | 3 +++
 src/interfaces/libpq/libpq-int.h           | 1 -
 src/test/isolation/isolation_main.c        | 2 ++
 src/test/regress/pg_regress.c              | 4 +++-
 src/test/regress/pg_regress.h              | 1 -
 src/test/regress/pg_regress_main.c         | 2 ++
 7 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/interfaces/ecpg/ecpglib/extern.h b/src/interfaces/ecpg/ecpglib/extern.h
index c3082beb4a3..fb9b5aebbe7 100644
--- a/src/interfaces/ecpg/ecpglib/extern.h
+++ b/src/interfaces/ecpg/ecpglib/extern.h
@@ -3,12 +3,12 @@
 #ifndef _ECPG_LIB_EXTERN_H
 #define _ECPG_LIB_EXTERN_H
 
-#include "postgres_fe.h"
 #include "libpq-fe.h"
 #include "sqlca.h"
 #include "sqlda-native.h"
 #include "sqlda-compat.h"
 #include "ecpg_config.h"
+
 #ifndef CHAR_BIT
 #include <limits.h>
 #endif
diff --git a/src/interfaces/ecpg/test/pg_regress_ecpg.c b/src/interfaces/ecpg/test/pg_regress_ecpg.c
index b3ff76c4469..b6ecb618e69 100644
--- a/src/interfaces/ecpg/test/pg_regress_ecpg.c
+++ b/src/interfaces/ecpg/test/pg_regress_ecpg.c
@@ -16,9 +16,12 @@
  *-------------------------------------------------------------------------
  */
 
+#include "postgres_fe.h"
+
 #include "pg_regress.h"
 
 #define LINEBUFSIZE 300
+
 static void
 ecpg_filter(const char *sourcefile, const char *outfile)
 {
diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h
index 360956d6eb3..b8ec3418c56 100644
--- a/src/interfaces/libpq/libpq-int.h
+++ b/src/interfaces/libpq/libpq-int.h
@@ -21,7 +21,6 @@
 #define LIBPQ_INT_H
 
 /* We assume libpq-fe.h has already been included. */
-#include "postgres_fe.h"
 #include "libpq-events.h"
 
 #include <time.h>
diff --git a/src/test/isolation/isolation_main.c b/src/test/isolation/isolation_main.c
index 46b48ee8557..8a3d7f51b39 100644
--- a/src/test/isolation/isolation_main.c
+++ b/src/test/isolation/isolation_main.c
@@ -10,6 +10,8 @@
  *-------------------------------------------------------------------------
  */
 
+#include "postgres_fe.h"
+
 #include "pg_regress.h"
 
 char		saved_argv0[MAXPGPATH];
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index d4d00d9c66f..c393ae1f511 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -16,7 +16,7 @@
  *-------------------------------------------------------------------------
  */
 
-#include "pg_regress.h"
+#include "postgres_fe.h"
 
 #include <ctype.h>
 #include <sys/stat.h>
@@ -29,6 +29,8 @@
 #include <sys/resource.h>
 #endif
 
+#include "pg_regress.h"
+
 #include "common/restricted_token.h"
 #include "common/username.h"
 #include "getopt_long.h"
diff --git a/src/test/regress/pg_regress.h b/src/test/regress/pg_regress.h
index 62433b158f6..f7745b16e11 100644
--- a/src/test/regress/pg_regress.h
+++ b/src/test/regress/pg_regress.h
@@ -8,7 +8,6 @@
  *-------------------------------------------------------------------------
  */
 
-#include "postgres_fe.h"
 #include <unistd.h>
 
 #ifndef WIN32
diff --git a/src/test/regress/pg_regress_main.c b/src/test/regress/pg_regress_main.c
index 6106c6bbda2..298ed758eeb 100644
--- a/src/test/regress/pg_regress_main.c
+++ b/src/test/regress/pg_regress_main.c
@@ -16,6 +16,8 @@
  *-------------------------------------------------------------------------
  */
 
+#include "postgres_fe.h"
+
 #include "pg_regress.h"
 
 /*
-- 
GitLab