diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index b25b3f1de0f5830243093e950e32a3959ebe9283..bed343ea0c0979a1aafd04a96520221580d65b4d 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -13,7 +13,7 @@
  *-------------------------------------------------------------------------
  */
 
-#include "plpgsql.h"
+#include "postgres.h"
 
 #include <ctype.h>
 
@@ -33,6 +33,8 @@
 #include "utils/rel.h"
 #include "utils/syscache.h"
 
+#include "plpgsql.h"
+
 
 /* ----------
  * Our own local and global variables
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 6fc3db07fe64d7ca46245e28fa759856d7a954ee..196e518e0df48c257407cb1d60e891b424e5e6db 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -13,7 +13,7 @@
  *-------------------------------------------------------------------------
  */
 
-#include "plpgsql.h"
+#include "postgres.h"
 
 #include <ctype.h>
 
@@ -41,6 +41,8 @@
 #include "utils/snapmgr.h"
 #include "utils/typcache.h"
 
+#include "plpgsql.h"
+
 
 typedef struct
 {
diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c
index 906fe0148d103635e3541f3b96b933b808feb9a9..93f89814b34fe2b82b5736b7e72e9285c9abcd9d 100644
--- a/src/pl/plpgsql/src/pl_funcs.c
+++ b/src/pl/plpgsql/src/pl_funcs.c
@@ -13,10 +13,12 @@
  *-------------------------------------------------------------------------
  */
 
-#include "plpgsql.h"
+#include "postgres.h"
 
 #include "utils/memutils.h"
 
+#include "plpgsql.h"
+
 
 /* ----------
  * Local variables for namespace handling
diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y
index 4a4cd6ae26fdacb2720eb3e29856df9eeb989abc..29729df550ea98b8be7133c044920fdbe66def5d 100644
--- a/src/pl/plpgsql/src/pl_gram.y
+++ b/src/pl/plpgsql/src/pl_gram.y
@@ -13,7 +13,7 @@
  *-------------------------------------------------------------------------
  */
 
-#include "plpgsql.h"
+#include "postgres.h"
 
 #include "catalog/namespace.h"
 #include "catalog/pg_type.h"
@@ -23,6 +23,8 @@
 #include "parser/scansup.h"
 #include "utils/builtins.h"
 
+#include "plpgsql.h"
+
 
 /* Location tracking support --- simpler than bison's default */
 #define YYLLOC_DEFAULT(Current, Rhs, N) \
diff --git a/src/pl/plpgsql/src/pl_handler.c b/src/pl/plpgsql/src/pl_handler.c
index 92d15810d7f6cc283d6cb8ceac090afa19161110..83ec4530dbac41c269a7e6cfd0e6a27091533ef1 100644
--- a/src/pl/plpgsql/src/pl_handler.c
+++ b/src/pl/plpgsql/src/pl_handler.c
@@ -13,7 +13,7 @@
  *-------------------------------------------------------------------------
  */
 
-#include "plpgsql.h"
+#include "postgres.h"
 
 #include "access/htup_details.h"
 #include "catalog/pg_proc.h"
@@ -26,6 +26,8 @@
 #include "utils/syscache.h"
 #include "utils/varlena.h"
 
+#include "plpgsql.h"
+
 
 static bool plpgsql_extra_checks_check_hook(char **newvalue, void **extra, GucSource source);
 static void plpgsql_extra_warnings_assign_hook(const char *newvalue, void *extra);
diff --git a/src/pl/plpgsql/src/pl_scanner.c b/src/pl/plpgsql/src/pl_scanner.c
index c40121308beb6b94922cab7fc755c52844f8a854..553be8c93c7ba9b392454b7b910a8f55155a8063 100644
--- a/src/pl/plpgsql/src/pl_scanner.c
+++ b/src/pl/plpgsql/src/pl_scanner.c
@@ -13,13 +13,15 @@
  *
  *-------------------------------------------------------------------------
  */
-#include "plpgsql.h"
+#include "postgres.h"
 
 #include "mb/pg_wchar.h"
 #include "parser/scanner.h"
 
+#include "plpgsql.h"
 #include "pl_gram.h"			/* must be after parser/scanner.h */
 
+
 #define PG_KEYWORD(a,b,c) {a,b,c},
 
 
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index 3421eed74fc5c84ea529f1c24e576c087da78416..b7e103b514388b387b5c5e4d1688c45cf48c7a8c 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -16,8 +16,6 @@
 #ifndef PLPGSQL_H
 #define PLPGSQL_H
 
-#include "postgres.h"
-
 #include "access/xact.h"
 #include "commands/event_trigger.h"
 #include "commands/trigger.h"