Skip to content

Commit 1cfd9e8

Browse files
committed
Fix executor/spi.h to follow our usual conventions for include files, ie,
not include postgres.h nor anything else it doesn't directly need. Add #includes to calling files as needed to compensate. Per my proposal of yesterday. This should be noted as a source code change in the 8.4 release notes, since it's likely to require changes in add-on modules.
1 parent b09f930 commit 1cfd9e8

File tree

22 files changed

+118
-86
lines changed

22 files changed

+118
-86
lines changed

contrib/spi/autoinc.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/spi/autoinc.c,v 1.15 2008/05/17 01:28:22 adunstan Exp $
2+
* $PostgreSQL: pgsql/contrib/spi/autoinc.c,v 1.16 2009/01/07 13:44:36 tgl Exp $
33
*/
4+
#include "postgres.h"
45

5-
#include "executor/spi.h" /* this is what you need to work with SPI */
6-
#include "commands/trigger.h" /* -"- and triggers */
7-
#include "commands/sequence.h" /* for nextval() */
6+
#include "catalog/pg_type.h"
7+
#include "commands/sequence.h"
8+
#include "commands/trigger.h"
9+
#include "executor/spi.h"
10+
#include "utils/builtins.h"
811

912
PG_MODULE_MAGIC;
1013

contrib/spi/insert_username.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
/*
22
* insert_username.c
33
* $Modified: Thu Oct 16 08:13:42 1997 by brook $
4-
* $PostgreSQL: pgsql/contrib/spi/insert_username.c,v 1.16 2008/03/25 22:42:42 tgl Exp $
4+
* $PostgreSQL: pgsql/contrib/spi/insert_username.c,v 1.17 2009/01/07 13:44:36 tgl Exp $
55
*
66
* insert user name in response to a trigger
77
* usage: insert_username (column_name)
88
*/
9+
#include "postgres.h"
910

10-
#include "executor/spi.h" /* this is what you need to work with SPI */
11-
#include "commands/trigger.h" /* -"- and triggers */
12-
#include "miscadmin.h" /* for GetUserName() */
11+
#include "catalog/pg_type.h"
12+
#include "commands/trigger.h"
13+
#include "executor/spi.h"
14+
#include "miscadmin.h"
15+
#include "utils/builtins.h"
1316

1417
PG_MODULE_MAGIC;
1518

contrib/spi/moddatetime.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
moddatetime.c
33
4-
$PostgreSQL: pgsql/contrib/spi/moddatetime.c,v 1.14 2007/02/01 19:10:23 momjian Exp $
4+
$PostgreSQL: pgsql/contrib/spi/moddatetime.c,v 1.15 2009/01/07 13:44:36 tgl Exp $
55
66
What is this?
77
It is a function to be called from a trigger for the purpose of updating
@@ -13,9 +13,11 @@ not really know what I am doing. I also had help from
1313
Jan Wieck <jwieck@debis.com> who told me about the timestamp_in("now") function.
1414
OH, me, I'm Terry Mackintosh <terry@terrym.com>
1515
*/
16+
#include "postgres.h"
1617

17-
#include "executor/spi.h" /* this is what you need to work with SPI */
18-
#include "commands/trigger.h" /* -"- and triggers */
18+
#include "catalog/pg_type.h"
19+
#include "executor/spi.h"
20+
#include "commands/trigger.h"
1921

2022
PG_MODULE_MAGIC;
2123

contrib/spi/refint.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/spi/refint.c,v 1.33 2008/05/17 01:28:22 adunstan Exp $
2+
* $PostgreSQL: pgsql/contrib/spi/refint.c,v 1.34 2009/01/07 13:44:36 tgl Exp $
33
*
44
*
55
* refint.c -- set of functions to define referential integrity
66
* constraints using general triggers.
77
*/
8+
#include "postgres.h"
89

9-
#include "executor/spi.h" /* this is what you need to work with SPI */
10-
11-
#include "commands/trigger.h" /* -"- and triggers */
1210
#include <ctype.h>
1311

12+
#include "commands/trigger.h"
13+
#include "executor/spi.h"
14+
#include "utils/builtins.h"
1415

1516
PG_MODULE_MAGIC;
1617

contrib/spi/timetravel.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/spi/timetravel.c,v 1.29 2008/05/17 01:28:22 adunstan Exp $
2+
* $PostgreSQL: pgsql/contrib/spi/timetravel.c,v 1.30 2009/01/07 13:44:36 tgl Exp $
33
*
44
*
55
* timetravel.c -- function to get time travel feature
66
* using general triggers.
7+
*
8+
* Modified by BÖJTHE Zoltán, Hungary, mailto:urdesobt@axelero.hu
79
*/
10+
#include "postgres.h"
811

9-
/* Modified by BÖJTHE Zoltán, Hungary, mailto:urdesobt@axelero.hu */
12+
#include <ctype.h>
1013

11-
#include "executor/spi.h" /* this is what you need to work with SPI */
12-
#include "commands/trigger.h" /* -"- and triggers */
13-
#include "miscadmin.h" /* for GetPgUserName() */
14+
#include "catalog/pg_type.h"
15+
#include "commands/trigger.h"
16+
#include "executor/spi.h"
17+
#include "miscadmin.h"
18+
#include "utils/builtins.h"
1419
#include "utils/nabstime.h"
1520

16-
#include <ctype.h> /* tolower () */
17-
18-
#define ABSTIMEOID 702 /* it should be in pg_type.h */
19-
2021
PG_MODULE_MAGIC;
2122

2223
/* AbsoluteTime currabstime(void); */

contrib/tablefunc/tablefunc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/tablefunc/tablefunc.c,v 1.58 2009/01/01 17:23:32 momjian Exp $
2+
* $PostgreSQL: pgsql/contrib/tablefunc/tablefunc.c,v 1.59 2009/01/07 13:44:36 tgl Exp $
33
*
44
*
55
* tablefunc
@@ -34,6 +34,7 @@
3434

3535
#include <math.h>
3636

37+
#include "catalog/pg_type.h"
3738
#include "fmgr.h"
3839
#include "funcapi.h"
3940
#include "executor/spi.h"

contrib/xml2/xpath.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/xml2/xpath.c,v 1.21 2008/10/29 00:00:38 tgl Exp $
2+
* $PostgreSQL: pgsql/contrib/xml2/xpath.c,v 1.22 2009/01/07 13:44:36 tgl Exp $
33
*
44
* Parser interface for DOM-based parser (libxml) rather than
5-
stream-based SAX-type parser */
6-
5+
* stream-based SAX-type parser
6+
*/
77
#include "postgres.h"
8-
#include "fmgr.h"
8+
99
#include "executor/spi.h"
10+
#include "fmgr.h"
1011
#include "funcapi.h"
11-
#include "miscadmin.h"
1212
#include "lib/stringinfo.h"
13+
#include "miscadmin.h"
14+
#include "utils/builtins.h"
1315

1416
/* libxml includes */
1517

contrib/xml2/xslt_proc.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/xml2/xslt_proc.c,v 1.13 2008/05/17 01:28:22 adunstan Exp $
2+
* $PostgreSQL: pgsql/contrib/xml2/xslt_proc.c,v 1.14 2009/01/07 13:44:36 tgl Exp $
33
*
4-
* XSLT processing functions (requiring libxslt) */
5-
/* John Gray, for Torchbox 2003-04-01 */
6-
4+
* XSLT processing functions (requiring libxslt)
5+
*
6+
* John Gray, for Torchbox 2003-04-01
7+
*/
78
#include "postgres.h"
8-
#include "fmgr.h"
9+
910
#include "executor/spi.h"
11+
#include "fmgr.h"
1012
#include "funcapi.h"
1113
#include "miscadmin.h"
14+
#include "utils/builtins.h"
1215

1316
/* libxml includes */
1417

doc/src/sgml/spi.sgml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/spi.sgml,v 1.62 2008/04/01 03:09:30 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/spi.sgml,v 1.63 2009/01/07 13:44:36 tgl Exp $ -->
22

33
<chapter id="spi">
44
<title>Server Programming Interface</title>
@@ -3617,7 +3617,10 @@ INSERT INTO a SELECT * FROM a;
36173617
</para>
36183618

36193619
<programlisting>
3620+
#include "postgres.h"
3621+
36203622
#include "executor/spi.h"
3623+
#include "utils/builtins.h"
36213624

36223625
#ifdef PG_MODULE_MAGIC
36233626
PG_MODULE_MAGIC;

src/backend/executor/spi.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,28 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.204 2009/01/02 20:42:00 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.205 2009/01/07 13:44:36 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515
#include "postgres.h"
1616

1717
#include "access/printtup.h"
1818
#include "access/sysattr.h"
19+
#include "access/xact.h"
1920
#include "catalog/heap.h"
21+
#include "catalog/pg_type.h"
2022
#include "commands/trigger.h"
23+
#include "executor/executor.h"
2124
#include "executor/spi_priv.h"
25+
#include "tcop/pquery.h"
26+
#include "tcop/utility.h"
27+
#include "utils/builtins.h"
28+
#include "utils/datum.h"
2229
#include "utils/lsyscache.h"
2330
#include "utils/memutils.h"
2431
#include "utils/snapmgr.h"
32+
#include "utils/syscache.h"
2533
#include "utils/typcache.h"
2634

2735

0 commit comments

Comments
 (0)