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. (The core
reason for this policy is to make it easy to verify that pg_config_os.h
is included before any system headers such as <stdio.h>; without that,
we have portability issues on some platforms due to variation in largefile
options across different modules in the backend. Also, if .h files were
responsible for choosing which of these key headers to include, .h files
that need to be includable in either frontend or backend compiles would be
in trouble.)
plpgsql was blithely ignoring this policy, so whack it upside the head
until it complies. I also chose to standardize on including plpgsql's
own .h files after all core-system headers that it pulls in. That
could've been done either way, but this way seems saner.
Discussion: https://postgr.es/m/CAEepm=2zCoeq3QxVwhS5DFeUh=yU6z81pbWMgfOB8OzyiBwxzw@mail.gmail.com
Discussion: https://postgr.es/m/11634.
1488932128@sss.pgh.pa.us
*-------------------------------------------------------------------------
*/
-#include "plpgsql.h"
+#include "postgres.h"
#include <ctype.h>
#include "utils/rel.h"
#include "utils/syscache.h"
+#include "plpgsql.h"
+
/* ----------
* Our own local and global variables
*-------------------------------------------------------------------------
*/
-#include "plpgsql.h"
+#include "postgres.h"
#include <ctype.h>
#include "utils/snapmgr.h"
#include "utils/typcache.h"
+#include "plpgsql.h"
+
typedef struct
{
*-------------------------------------------------------------------------
*/
-#include "plpgsql.h"
+#include "postgres.h"
#include "utils/memutils.h"
+#include "plpgsql.h"
+
/* ----------
* Local variables for namespace handling
*-------------------------------------------------------------------------
*/
-#include "plpgsql.h"
+#include "postgres.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#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) \
*-------------------------------------------------------------------------
*/
-#include "plpgsql.h"
+#include "postgres.h"
#include "access/htup_details.h"
#include "catalog/pg_proc.h"
#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);
*
*-------------------------------------------------------------------------
*/
-#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},
#ifndef PLPGSQL_H
#define PLPGSQL_H
-#include "postgres.h"
-
#include "access/xact.h"
#include "commands/event_trigger.h"
#include "commands/trigger.h"