Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit039dfbf

Browse files
committed
Reduce the need for frontend programs to include "postgres.h" by refactoring
inclusions in src/include/catalog/*.h files. The main idea here is to pushfunction declarations for src/backend/catalog/*.c files into separate headers,rather than sticking them into the corresponding catalog definition file ashas been done in the past. This commit only carries out that idea fully forpg_proc, pg_type and pg_conversion, but that's enough for the moment ---if pg_list.h ever becomes unsafe for frontend code to include, we'll needto work a bit more.Zdenek Kotala
1 parent73b0300 commit039dfbf

File tree

67 files changed

+357
-447
lines changed

Some content is hidden

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

67 files changed

+357
-447
lines changed

‎src/backend/catalog/dependency.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.70 2008/03/26 21:10:37 alvherre Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.71 2008/03/27 03:57:33 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -29,6 +29,7 @@
2929
#include"catalog/pg_cast.h"
3030
#include"catalog/pg_constraint.h"
3131
#include"catalog/pg_conversion.h"
32+
#include"catalog/pg_conversion_fn.h"
3233
#include"catalog/pg_database.h"
3334
#include"catalog/pg_depend.h"
3435
#include"catalog/pg_language.h"

‎src/backend/catalog/heap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.331 2008/03/26 21:10:37 alvherre Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.332 2008/03/27 03:57:33 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -45,6 +45,7 @@
4545
#include"catalog/pg_statistic.h"
4646
#include"catalog/pg_tablespace.h"
4747
#include"catalog/pg_type.h"
48+
#include"catalog/pg_type_fn.h"
4849
#include"commands/tablecmds.h"
4950
#include"commands/typecmds.h"
5051
#include"miscadmin.h"

‎src/backend/catalog/namespace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.104 2008/01/01 19:45:48 momjian Exp $
16+
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.105 2008/03/27 03:57:33 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -24,6 +24,7 @@
2424
#include"catalog/namespace.h"
2525
#include"catalog/pg_authid.h"
2626
#include"catalog/pg_conversion.h"
27+
#include"catalog/pg_conversion_fn.h"
2728
#include"catalog/pg_namespace.h"
2829
#include"catalog/pg_opclass.h"
2930
#include"catalog/pg_operator.h"

‎src/backend/catalog/pg_aggregate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.91 2008/03/25 22:42:42 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.92 2008/03/27 03:57:33 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -21,6 +21,7 @@
2121
#include"catalog/pg_language.h"
2222
#include"catalog/pg_operator.h"
2323
#include"catalog/pg_proc.h"
24+
#include"catalog/pg_proc_fn.h"
2425
#include"catalog/pg_type.h"
2526
#include"miscadmin.h"
2627
#include"parser/parse_coerce.h"

‎src/backend/catalog/pg_conversion.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.41 2008/03/26 21:10:37 alvherre Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.42 2008/03/27 03:57:33 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -19,6 +19,7 @@
1919
#include"catalog/indexing.h"
2020
#include"catalog/namespace.h"
2121
#include"catalog/pg_conversion.h"
22+
#include"catalog/pg_conversion_fn.h"
2223
#include"catalog/pg_namespace.h"
2324
#include"catalog/pg_proc.h"
2425
#include"mb/pg_wchar.h"

‎src/backend/catalog/pg_proc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.150 2008/03/25 22:42:42 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.151 2008/03/27 03:57:33 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -21,6 +21,7 @@
2121
#include"catalog/pg_language.h"
2222
#include"catalog/pg_namespace.h"
2323
#include"catalog/pg_proc.h"
24+
#include"catalog/pg_proc_fn.h"
2425
#include"catalog/pg_type.h"
2526
#include"executor/functions.h"
2627
#include"funcapi.h"

‎src/backend/catalog/pg_type.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.117 2008/03/25 22:42:42 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.118 2008/03/27 03:57:33 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -21,6 +21,7 @@
2121
#include"catalog/pg_namespace.h"
2222
#include"catalog/pg_proc.h"
2323
#include"catalog/pg_type.h"
24+
#include"catalog/pg_type_fn.h"
2425
#include"commands/typecmds.h"
2526
#include"miscadmin.h"
2627
#include"parser/scansup.h"

‎src/backend/commands/conversioncmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.32 2008/01/01 19:45:48 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.33 2008/03/27 03:57:33 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -18,6 +18,7 @@
1818
#include"catalog/dependency.h"
1919
#include"catalog/indexing.h"
2020
#include"catalog/pg_conversion.h"
21+
#include"catalog/pg_conversion_fn.h"
2122
#include"catalog/pg_type.h"
2223
#include"commands/conversioncmds.h"
2324
#include"mb/pg_wchar.h"

‎src/backend/commands/functioncmds.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.90 2008/03/26 21:10:37 alvherre Exp $
13+
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.91 2008/03/27 03:57:33 tgl Exp $
1414
*
1515
* DESCRIPTION
1616
* These routines take the parse tree and pick out the
@@ -41,7 +41,9 @@
4141
#include"catalog/pg_language.h"
4242
#include"catalog/pg_namespace.h"
4343
#include"catalog/pg_proc.h"
44+
#include"catalog/pg_proc_fn.h"
4445
#include"catalog/pg_type.h"
46+
#include"catalog/pg_type_fn.h"
4547
#include"commands/defrem.h"
4648
#include"commands/proclang.h"
4749
#include"miscadmin.h"

‎src/backend/commands/proclang.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.76 2008/03/26 21:10:37 alvherre Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.77 2008/03/27 03:57:33 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -22,6 +22,7 @@
2222
#include"catalog/pg_namespace.h"
2323
#include"catalog/pg_pltemplate.h"
2424
#include"catalog/pg_proc.h"
25+
#include"catalog/pg_proc_fn.h"
2526
#include"catalog/pg_type.h"
2627
#include"commands/dbcommands.h"
2728
#include"commands/defrem.h"

‎src/backend/commands/tablecmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.247 2008/03/26 21:10:37 alvherre Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.248 2008/03/27 03:57:33 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -32,6 +32,7 @@
3232
#include"catalog/pg_tablespace.h"
3333
#include"catalog/pg_trigger.h"
3434
#include"catalog/pg_type.h"
35+
#include"catalog/pg_type_fn.h"
3536
#include"catalog/toasting.h"
3637
#include"commands/cluster.h"
3738
#include"commands/defrem.h"

‎src/backend/commands/typecmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.116 2008/03/26 21:10:38 alvherre Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.117 2008/03/27 03:57:33 tgl Exp $
1212
*
1313
* DESCRIPTION
1414
* The "DefineFoo" routines take the parse tree and pick out the
@@ -43,6 +43,7 @@
4343
#include"catalog/pg_enum.h"
4444
#include"catalog/pg_namespace.h"
4545
#include"catalog/pg_type.h"
46+
#include"catalog/pg_type_fn.h"
4647
#include"commands/defrem.h"
4748
#include"commands/tablecmds.h"
4849
#include"commands/typecmds.h"

‎src/backend/parser/keywords.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,34 @@
33
* keywords.c
44
* lexical token lookup for key words in PostgreSQL
55
*
6+
* NB: This file is also used by pg_dump.
7+
*
8+
*
69
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
710
* Portions Copyright (c) 1994, Regents of the University of California
811
*
912
*
1013
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.194 2008/01/01 19:45:50 momjian Exp $
14+
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.195 2008/03/27 03:57:33 tgl Exp $
1215
*
1316
*-------------------------------------------------------------------------
1417
*/
15-
#include"postgres.h"
18+
19+
/* Use c.h so that this file can be built in either frontend or backend */
20+
#include"c.h"
1621

1722
#include<ctype.h>
1823

19-
#include"nodes/parsenodes.h"
20-
#include"parser/gramparse.h"/* required before parser/parse.h! */
24+
/*
25+
* This macro definition overrides the YYSTYPE union definition in parse.h.
26+
* We don't need that struct in this file, and including the real definition
27+
* would require sucking in some backend-only include files.
28+
*/
29+
#defineYYSTYPE int
30+
2131
#include"parser/keywords.h"
2232
#include"parser/parse.h"
2333

24-
/* NB: This file is also used by pg_dump. */
2534

2635
/*
2736
* List of keyword (name, token-value, category) entries.

‎src/backend/utils/hash/pg_crc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
*
2020
*
2121
* IDENTIFICATION
22-
* $PostgreSQL: pgsql/src/backend/utils/hash/pg_crc.c,v 1.18 2008/01/01 19:45:53 momjian Exp $
22+
* $PostgreSQL: pgsql/src/backend/utils/hash/pg_crc.c,v 1.19 2008/03/27 03:57:33 tgl Exp $
2323
*
2424
*-------------------------------------------------------------------------
2525
*/
26-
#include"postgres.h"
2726

27+
/* Use c.h so that this file can be built in either frontend or backend */
28+
#include"c.h"
2829

2930

3031
/*

‎src/bin/pg_config/pg_config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
*
1818
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
1919
*
20-
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.27 2008/02/18 14:51:48 petere Exp $
20+
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.28 2008/03/27 03:57:33 tgl Exp $
2121
*
2222
*-------------------------------------------------------------------------
2323
*/
2424

25-
#include"postgres.h"
25+
#include"postgres_fe.h"
2626

2727
#include"port.h"
2828

‎src/bin/pg_controldata/pg_controldata.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
77
* licence: BSD
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.37 2008/02/17 02:09:29 tgl Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.38 2008/03/27 03:57:33 tgl Exp $
1010
*/
11-
#include"postgres.h"
11+
#include"postgres_fe.h"
1212

1313
#include<unistd.h>
1414
#include<time.h>

‎src/bin/pg_dump/common.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.102 2008/01/01 19:45:55 momjian Exp $
14+
* $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.103 2008/03/27 03:57:33 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
18-
1918
#include"postgres_fe.h"
20-
#include"pg_backup_archiver.h"
2119

22-
#include"postgres.h"
20+
#include<ctype.h>
21+
2322
#include"catalog/pg_class.h"
2423

25-
#include<ctype.h>
24+
#include"pg_backup_archiver.h"
2625

2726

2827
/*

‎src/bin/pg_dump/pg_dump.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,14 @@
1212
*by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.484 2008/03/26 14:32:22 momjian Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.485 2008/03/27 03:57:33 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
1919

20-
/*
21-
* Although this is not a backend module, we must include postgres.h anyway
22-
* so that we can include a bunch of backend include files. pg_dump has
23-
* never pretended to be very independent of the backend anyhow ...
24-
*/
25-
#include"postgres.h"
20+
#include"postgres_fe.h"
2621

2722
#include<unistd.h>
28-
2923
#include<ctype.h>
3024
#ifdefENABLE_NLS
3125
#include<locale.h>
@@ -40,12 +34,12 @@
4034
intoptreset;
4135
#endif
4236

37+
#include"access/attnum.h"
4338
#include"access/htup.h"
4439
#include"catalog/pg_class.h"
4540
#include"catalog/pg_proc.h"
4641
#include"catalog/pg_trigger.h"
4742
#include"catalog/pg_type.h"
48-
#include"commands/sequence.h"
4943
#include"libpq/libpq-fs.h"
5044

5145
#include"pg_backup_archiver.h"

‎src/bin/psql/print.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
*
44
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.96 2008/01/01 19:45:56 momjian Exp $
7-
*
8-
* Note: we include postgres.h not postgres_fe.h so that we can include
9-
* catalog/pg_type.h, and thereby have access to INT4OID and similar macros.
6+
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.97 2008/03/27 03:57:34 tgl Exp $
107
*/
11-
#include"postgres.h"
8+
#include"postgres_fe.h"
9+
1210
#include"print.h"
1311
#include"catalog/pg_type.h"
1412

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp