Bring plpgsql into line with header inclusion policy.

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
This commit is contained in:
Tom Lane 2017-03-08 17:21:08 -05:00
parent d6b059ec74
commit 08da52859a
7 changed files with 18 additions and 8 deletions

View File

@ -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

View File

@ -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
{

View File

@ -13,10 +13,12 @@
*-------------------------------------------------------------------------
*/
#include "plpgsql.h"
#include "postgres.h"
#include "utils/memutils.h"
#include "plpgsql.h"
/* ----------
* Local variables for namespace handling

View File

@ -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) \

View File

@ -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);

View File

@ -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},

View File

@ -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"