Skip to content

Commit 7e73503

Browse files
author
Amit Kapila
committed
Make the order of the header file includes consistent in contrib modules.
The basic rule we follow here is to always first include 'postgres.h' or 'postgres_fe.h' whichever is applicable, then system header includes and then Postgres header includes.  In this, we also follow that all the Postgres header includes are in order based on their ASCII value.  We generally follow these rules, but the code has deviated in many places. This commit makes it consistent just for contrib modules. The later commits will enforce similar rules in other parts of code. Author: Vignesh C Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/CALDaNm2Sznv8RR6Ex-iJO6xAdsxgWhCoETkaYX=+9DW3q0QCfA@mail.gmail.com
1 parent 59c2617 commit 7e73503

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+115
-183
lines changed

contrib/bloom/blcost.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
*/
1313
#include "postgres.h"
1414

15+
#include "bloom.h"
1516
#include "fmgr.h"
1617
#include "utils/selfuncs.h"
1718

18-
#include "bloom.h"
19-
2019
/*
2120
* Estimate cost of bloom index scan.
2221
*/

contrib/bloom/blinsert.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "access/genam.h"
1616
#include "access/generic_xlog.h"
1717
#include "access/tableam.h"
18+
#include "bloom.h"
1819
#include "catalog/index.h"
1920
#include "miscadmin.h"
2021
#include "storage/bufmgr.h"
@@ -23,8 +24,6 @@
2324
#include "utils/memutils.h"
2425
#include "utils/rel.h"
2526

26-
#include "bloom.h"
27-
2827
PG_MODULE_MAGIC;
2928

3029
/*

contrib/bloom/blscan.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@
1313
#include "postgres.h"
1414

1515
#include "access/relscan.h"
16-
#include "pgstat.h"
16+
#include "bloom.h"
1717
#include "miscadmin.h"
18+
#include "pgstat.h"
1819
#include "storage/bufmgr.h"
1920
#include "storage/lmgr.h"
2021
#include "utils/memutils.h"
2122
#include "utils/rel.h"
2223

23-
#include "bloom.h"
24-
2524
/*
2625
* Begin scan of bloom index.
2726
*/

contrib/bloom/blutils.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@
1515

1616
#include "access/amapi.h"
1717
#include "access/generic_xlog.h"
18+
#include "access/reloptions.h"
19+
#include "bloom.h"
1820
#include "catalog/index.h"
19-
#include "storage/lmgr.h"
2021
#include "miscadmin.h"
2122
#include "storage/bufmgr.h"
22-
#include "storage/indexfsm.h"
23-
#include "utils/memutils.h"
24-
#include "access/reloptions.h"
2523
#include "storage/freespace.h"
2624
#include "storage/indexfsm.h"
27-
28-
#include "bloom.h"
25+
#include "storage/lmgr.h"
26+
#include "utils/memutils.h"
2927

3028
/* Signature dealing macros - note i is assumed to be of type int */
3129
#define GETWORD(x,i) ( *( (BloomSignatureWord *)(x) + ( (i) / SIGNWORDBITS ) ) )

contrib/bloom/blvalidate.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "access/amvalidate.h"
1616
#include "access/htup_details.h"
17+
#include "bloom.h"
1718
#include "catalog/pg_amop.h"
1819
#include "catalog/pg_amproc.h"
1920
#include "catalog/pg_opclass.h"
@@ -24,8 +25,6 @@
2425
#include "utils/regproc.h"
2526
#include "utils/syscache.h"
2627

27-
#include "bloom.h"
28-
2928
/*
3029
* Validator for a bloom opclass.
3130
*/

contrib/btree_gin/btree_gin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "utils/inet.h"
1515
#include "utils/numeric.h"
1616
#include "utils/timestamp.h"
17-
#include "utils/varbit.h"
1817
#include "utils/uuid.h"
18+
#include "utils/varbit.h"
1919

2020
PG_MODULE_MAGIC;
2121

contrib/btree_gist/btree_enum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
* contrib/btree_gist/btree_enum.c
33
*/
44
#include "postgres.h"
5-
#include "fmgr.h"
6-
#include "utils/builtins.h"
75

86
#include "btree_gist.h"
97
#include "btree_utils_num.h"
8+
#include "fmgr.h"
9+
#include "utils/builtins.h"
1010

1111
/* enums are really Oids, so we just use the same structure */
1212

contrib/btree_gist/btree_inet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
#include "btree_gist.h"
77
#include "btree_utils_num.h"
8+
#include "catalog/pg_type.h"
89
#include "utils/builtins.h"
910
#include "utils/inet.h"
10-
#include "catalog/pg_type.h"
1111

1212
typedef struct inetkey
1313
{

contrib/btree_gist/btree_numeric.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
*/
44
#include "postgres.h"
55

6-
#include "btree_gist.h"
7-
86
#include <math.h>
97
#include <float.h>
108

9+
#include "btree_gist.h"
1110
#include "btree_utils_var.h"
1211
#include "utils/builtins.h"
1312
#include "utils/numeric.h"

contrib/btree_gist/btree_utils_var.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
*/
44
#include "postgres.h"
55

6-
#include "btree_gist.h"
7-
86
#include <math.h>
97
#include <limits.h>
108
#include <float.h>
119

10+
#include "btree_gist.h"
1211
#include "btree_utils_var.h"
13-
#include "utils/pg_locale.h"
1412
#include "utils/builtins.h"
13+
#include "utils/pg_locale.h"
1514
#include "utils/rel.h"
1615

1716
/* used for key sorting */

contrib/cube/cube.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212

1313
#include "access/gist.h"
1414
#include "access/stratnum.h"
15+
#include "cubedata.h"
1516
#include "utils/array.h"
1617
#include "utils/float.h"
1718

18-
#include "cubedata.h"
19-
2019
PG_MODULE_MAGIC;
2120

2221
/*

contrib/dblink/dblink.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434

3535
#include <limits.h>
3636

37-
#include "libpq-fe.h"
38-
3937
#include "access/htup_details.h"
4038
#include "access/relation.h"
4139
#include "access/reloptions.h"
@@ -50,6 +48,7 @@
5048
#include "foreign/foreign.h"
5149
#include "funcapi.h"
5250
#include "lib/stringinfo.h"
51+
#include "libpq-fe.h"
5352
#include "mb/pg_wchar.h"
5453
#include "miscadmin.h"
5554
#include "parser/scansup.h"

contrib/hstore/hstore_gist.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
#include "access/gist.h"
77
#include "access/stratnum.h"
88
#include "catalog/pg_type.h"
9-
#include "utils/pg_crc.h"
10-
119
#include "hstore.h"
10+
#include "utils/pg_crc.h"
1211

1312
/* bigint defines */
1413
#define BITBYTE 8

contrib/hstore/hstore_io.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "access/htup_details.h"
99
#include "catalog/pg_type.h"
1010
#include "funcapi.h"
11+
#include "hstore.h"
1112
#include "lib/stringinfo.h"
1213
#include "libpq/pqformat.h"
1314
#include "utils/builtins.h"
@@ -18,8 +19,6 @@
1819
#include "utils/memutils.h"
1920
#include "utils/typcache.h"
2021

21-
#include "hstore.h"
22-
2322
PG_MODULE_MAGIC;
2423

2524
/* old names for C functions */

contrib/hstore/hstore_op.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
#include "access/htup_details.h"
77
#include "catalog/pg_type.h"
88
#include "funcapi.h"
9+
#include "hstore.h"
910
#include "utils/builtins.h"
1011
#include "utils/hashutils.h"
1112
#include "utils/memutils.h"
1213

13-
#include "hstore.h"
14-
1514
/* old names for C functions */
1615
HSTORE_POLLUTE(hstore_fetchval, fetchval);
1716
HSTORE_POLLUTE(hstore_exists, exists);

contrib/hstore_plpython/hstore_plpython.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include "postgres.h"
22

33
#include "fmgr.h"
4-
#include "plpython.h"
5-
#include "plpy_typeio.h"
64
#include "hstore/hstore.h"
5+
#include "plpy_typeio.h"
6+
#include "plpython.h"
77

88
PG_MODULE_MAGIC;
99

contrib/intarray/_int_bool.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
*/
44
#include "postgres.h"
55

6+
#include "_int.h"
67
#include "miscadmin.h"
78
#include "utils/builtins.h"
89

9-
#include "_int.h"
10-
1110
PG_FUNCTION_INFO_V1(bqarr_in);
1211
PG_FUNCTION_INFO_V1(bqarr_out);
1312
PG_FUNCTION_INFO_V1(boolop);

contrib/intarray/_int_gin.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
*/
44
#include "postgres.h"
55

6+
#include "_int.h"
67
#include "access/gin.h"
78
#include "access/stratnum.h"
89

9-
#include "_int.h"
10-
1110
PG_FUNCTION_INFO_V1(ginint4_queryextract);
1211

1312
Datum

contrib/intarray/_int_gist.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55

66
#include <limits.h>
77

8+
#include "_int.h"
89
#include "access/gist.h"
910
#include "access/stratnum.h"
1011

11-
#include "_int.h"
12-
1312
#define GETENTRY(vec,pos) ((ArrayType *) DatumGetPointer((vec)->vector[(pos)].key))
1413

1514
/*

contrib/intarray/_int_op.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44
#include "postgres.h"
55

6-
76
#include "_int.h"
87

98
PG_MODULE_MAGIC;

contrib/intarray/_int_selfuncs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
*-------------------------------------------------------------------------
1414
*/
1515
#include "postgres.h"
16-
#include "_int.h"
1716

17+
#include "_int.h"
1818
#include "access/htup_details.h"
1919
#include "catalog/pg_operator.h"
2020
#include "catalog/pg_statistic.h"
2121
#include "catalog/pg_type.h"
22+
#include "miscadmin.h"
2223
#include "utils/builtins.h"
24+
#include "utils/lsyscache.h"
2325
#include "utils/selfuncs.h"
2426
#include "utils/syscache.h"
25-
#include "utils/lsyscache.h"
26-
#include "miscadmin.h"
2727

2828
PG_FUNCTION_INFO_V1(_int_overlap_sel);
2929
PG_FUNCTION_INFO_V1(_int_contains_sel);

contrib/intarray/_int_tool.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55

66
#include <limits.h>
77

8-
#include "catalog/pg_type.h"
9-
108
#include "_int.h"
11-
9+
#include "catalog/pg_type.h"
1210

1311
/* arguments are assumed sorted & unique-ified */
1412
bool

contrib/intarray/_intbig_gist.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
*/
44
#include "postgres.h"
55

6+
#include "_int.h"
67
#include "access/gist.h"
78
#include "access/stratnum.h"
89
#include "port/pg_bitutils.h"
910

10-
#include "_int.h"
11-
1211
#define GETENTRY(vec,pos) ((GISTTYPE *) DatumGetPointer((vec)->vector[(pos)].key))
1312
/*
1413
** _intbig methods

contrib/isn/isn.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414

1515
#include "postgres.h"
1616

17-
#include "fmgr.h"
18-
#include "utils/builtins.h"
19-
20-
#include "isn.h"
2117
#include "EAN13.h"
2218
#include "ISBN.h"
2319
#include "ISMN.h"
2420
#include "ISSN.h"
2521
#include "UPC.h"
22+
#include "fmgr.h"
23+
#include "isn.h"
24+
#include "utils/builtins.h"
2625

2726
PG_MODULE_MAGIC;
2827

contrib/jsonb_plperl/jsonb_plperl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include "fmgr.h"
66
#include "plperl.h"
77
#include "plperl_helpers.h"
8-
#include "utils/jsonb.h"
98
#include "utils/fmgrprotos.h"
9+
#include "utils/jsonb.h"
1010

1111
PG_MODULE_MAGIC;
1212

contrib/jsonb_plpython/jsonb_plpython.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include "postgres.h"
22

3-
#include "plpython.h"
43
#include "plpy_elog.h"
54
#include "plpy_typeio.h"
6-
#include "utils/jsonb.h"
5+
#include "plpython.h"
76
#include "utils/fmgrprotos.h"
7+
#include "utils/jsonb.h"
88
#include "utils/numeric.h"
99

1010
PG_MODULE_MAGIC;

contrib/ltree/_ltree_gist.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99

1010
#include "access/gist.h"
1111
#include "access/stratnum.h"
12-
#include "port/pg_bitutils.h"
13-
1412
#include "crc32.h"
1513
#include "ltree.h"
16-
14+
#include "port/pg_bitutils.h"
1715

1816
PG_FUNCTION_INFO_V1(_ltree_compress);
1917
PG_FUNCTION_INFO_V1(_ltree_same);

contrib/ltree/crc32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#define TOLOWER(x) (x)
1717
#endif
1818

19-
#include "utils/pg_crc.h"
2019
#include "crc32.h"
20+
#include "utils/pg_crc.h"
2121

2222
unsigned int
2323
ltree_crc32_sz(char *buf, int size)

0 commit comments

Comments
 (0)