]> granicus.if.org Git - postgresql/commitdiff
Fix executor/spi.h to follow our usual conventions for include files, ie,
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 7 Jan 2009 13:44:37 +0000 (13:44 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 7 Jan 2009 13:44:37 +0000 (13:44 +0000)
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.

22 files changed:
contrib/spi/autoinc.c
contrib/spi/insert_username.c
contrib/spi/moddatetime.c
contrib/spi/refint.c
contrib/spi/timetravel.c
contrib/tablefunc/tablefunc.c
contrib/xml2/xpath.c
contrib/xml2/xslt_proc.c
doc/src/sgml/spi.sgml
src/backend/executor/spi.c
src/backend/utils/adt/ri_triggers.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/tsquery_rewrite.c
src/backend/utils/adt/tsvector_op.c
src/backend/utils/adt/xml.c
src/include/executor/spi.h
src/pl/plperl/plperl.c
src/pl/plpgsql/src/gram.y
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/plpgsql.h
src/pl/tcl/pltcl.c
src/test/regress/regress.c

index bc39db00c26c9b2d0f162924f0f16647473f09a6..f5554146648e6ed5df3fc233e3ca46de24b3c01a 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * $PostgreSQL: pgsql/contrib/spi/autoinc.c,v 1.15 2008/05/17 01:28:22 adunstan Exp $ 
+ * $PostgreSQL: pgsql/contrib/spi/autoinc.c,v 1.16 2009/01/07 13:44:36 tgl Exp $ 
  */
+#include "postgres.h"
 
-#include "executor/spi.h"              /* this is what you need to work with SPI */
-#include "commands/trigger.h"  /* -"- and triggers */
-#include "commands/sequence.h" /* for nextval() */
+#include "catalog/pg_type.h"
+#include "commands/sequence.h"
+#include "commands/trigger.h"
+#include "executor/spi.h"
+#include "utils/builtins.h"
 
 PG_MODULE_MAGIC;
 
index 9541677ebde19022b8df0e3f43304ad90721acfa..377284a61333d3bab3c238bb27c08a8e8b3a550c 100644 (file)
@@ -1,15 +1,18 @@
 /*
  * insert_username.c
  * $Modified: Thu Oct 16 08:13:42 1997 by brook $
- * $PostgreSQL: pgsql/contrib/spi/insert_username.c,v 1.16 2008/03/25 22:42:42 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/spi/insert_username.c,v 1.17 2009/01/07 13:44:36 tgl Exp $
  *
  * insert user name in response to a trigger
  * usage:  insert_username (column_name)
  */
+#include "postgres.h"
 
-#include "executor/spi.h"              /* this is what you need to work with SPI */
-#include "commands/trigger.h"  /* -"- and triggers */
-#include "miscadmin.h"                 /* for GetUserName() */
+#include "catalog/pg_type.h"
+#include "commands/trigger.h"
+#include "executor/spi.h"
+#include "miscadmin.h"
+#include "utils/builtins.h"
 
 PG_MODULE_MAGIC;
 
index b4c9fe4de96b9901b1407f2539b37781cb6e8200..0b4d3ba35195775ad2992e154af7e94c1739d8b5 100644 (file)
@@ -1,7 +1,7 @@
 /*
 moddatetime.c
 
-$PostgreSQL: pgsql/contrib/spi/moddatetime.c,v 1.14 2007/02/01 19:10:23 momjian Exp $
+$PostgreSQL: pgsql/contrib/spi/moddatetime.c,v 1.15 2009/01/07 13:44:36 tgl Exp $
 
 What is this?
 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
 Jan Wieck <jwieck@debis.com> who told me about the timestamp_in("now") function.
 OH, me, I'm Terry Mackintosh <terry@terrym.com>
 */
+#include "postgres.h"
 
-#include "executor/spi.h"              /* this is what you need to work with SPI */
-#include "commands/trigger.h"  /* -"- and triggers */
+#include "catalog/pg_type.h"
+#include "executor/spi.h"
+#include "commands/trigger.h"
 
 PG_MODULE_MAGIC;
 
index dd628e7be3ee51668a6a3a44390a045e4386f568..aaef7b4977b9060b3cd877b101bb60943ca747ab 100644 (file)
@@ -1,16 +1,17 @@
 /*
- * $PostgreSQL: pgsql/contrib/spi/refint.c,v 1.33 2008/05/17 01:28:22 adunstan Exp $ 
+ * $PostgreSQL: pgsql/contrib/spi/refint.c,v 1.34 2009/01/07 13:44:36 tgl Exp $ 
  *
  *
  * refint.c -- set of functions to define referential integrity
  *             constraints using general triggers.
  */
+#include "postgres.h"
 
-#include "executor/spi.h"              /* this is what you need to work with SPI */
-
-#include "commands/trigger.h"  /* -"- and triggers */
 #include <ctype.h>
 
+#include "commands/trigger.h"
+#include "executor/spi.h"
+#include "utils/builtins.h"
 
 PG_MODULE_MAGIC;
 
index a0a1b22923fa2354a0e62fe18f97bf727c1e06aa..a949d2d81797d0e3be9900f77860e985ae3f86d3 100644 (file)
@@ -1,22 +1,23 @@
 /*
- * $PostgreSQL: pgsql/contrib/spi/timetravel.c,v 1.29 2008/05/17 01:28:22 adunstan Exp $ 
+ * $PostgreSQL: pgsql/contrib/spi/timetravel.c,v 1.30 2009/01/07 13:44:36 tgl Exp $ 
  *
  *
  * timetravel.c --     function to get time travel feature
  *             using general triggers.
+ *
+ * Modified by BÖJTHE Zoltán, Hungary, mailto:urdesobt@axelero.hu
  */
+#include "postgres.h"
 
-/* Modified by BÖJTHE Zoltán, Hungary, mailto:urdesobt@axelero.hu */
+#include <ctype.h>
 
-#include "executor/spi.h"              /* this is what you need to work with SPI */
-#include "commands/trigger.h"  /* -"- and triggers */
-#include "miscadmin.h"                 /* for GetPgUserName() */
+#include "catalog/pg_type.h"
+#include "commands/trigger.h"
+#include "executor/spi.h"
+#include "miscadmin.h"
+#include "utils/builtins.h"
 #include "utils/nabstime.h"
 
-#include <ctype.h>                             /* tolower () */
-
-#define ABSTIMEOID     702                     /* it should be in pg_type.h */
-
 PG_MODULE_MAGIC;
 
 /* AbsoluteTime currabstime(void); */
index dc7924733c7299cf390e5e224b47629c3dd7d3e9..5829c841112b8f019c2652b00fb00a5811d04a6f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $PostgreSQL: pgsql/contrib/tablefunc/tablefunc.c,v 1.58 2009/01/01 17:23:32 momjian Exp $ 
+ * $PostgreSQL: pgsql/contrib/tablefunc/tablefunc.c,v 1.59 2009/01/07 13:44:36 tgl Exp $ 
  *
  *
  * tablefunc
@@ -34,6 +34,7 @@
 
 #include <math.h>
 
+#include "catalog/pg_type.h"
 #include "fmgr.h"
 #include "funcapi.h"
 #include "executor/spi.h"
index b2f3342f737c42592b69a3c4ca32d02e13f01d25..d5244a1ce343682fc3fe1ee6d9e82403bb9e063e 100644 (file)
@@ -1,15 +1,17 @@
 /*
- * $PostgreSQL: pgsql/contrib/xml2/xpath.c,v 1.21 2008/10/29 00:00:38 tgl Exp $ 
+ * $PostgreSQL: pgsql/contrib/xml2/xpath.c,v 1.22 2009/01/07 13:44:36 tgl Exp $
  *
  * Parser interface for DOM-based parser (libxml) rather than
-   stream-based SAX-type parser */
-
+ * stream-based SAX-type parser
+ */
 #include "postgres.h"
-#include "fmgr.h"
+
 #include "executor/spi.h"
+#include "fmgr.h"
 #include "funcapi.h"
-#include "miscadmin.h"
 #include "lib/stringinfo.h"
+#include "miscadmin.h"
+#include "utils/builtins.h"
 
 /* libxml includes */
 
index 425a9393337c4de089262d0f402ea4ddb82f024b..4ca176ed2ec88de1d3d6fd04847b7f73057e26bd 100644 (file)
@@ -1,14 +1,17 @@
 /*
- * $PostgreSQL: pgsql/contrib/xml2/xslt_proc.c,v 1.13 2008/05/17 01:28:22 adunstan Exp $ 
+ * $PostgreSQL: pgsql/contrib/xml2/xslt_proc.c,v 1.14 2009/01/07 13:44:36 tgl Exp $ 
  *
- * XSLT processing functions (requiring libxslt) */
-/* John Gray, for Torchbox 2003-04-01 */
-
+ * XSLT processing functions (requiring libxslt)
+ *
+ * John Gray, for Torchbox 2003-04-01
+ */
 #include "postgres.h"
-#include "fmgr.h"
+
 #include "executor/spi.h"
+#include "fmgr.h"
 #include "funcapi.h"
 #include "miscadmin.h"
+#include "utils/builtins.h"
 
 /* libxml includes */
 
index 04cd0ca1791c20dc800b670929eb3fa352fd9571..9df76db0457427c21dff7aed3147f3b765c608f5 100644 (file)
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/spi.sgml,v 1.62 2008/04/01 03:09:30 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/spi.sgml,v 1.63 2009/01/07 13:44:36 tgl Exp $ -->
 
 <chapter id="spi">
  <title>Server Programming Interface</title>
@@ -3617,7 +3617,10 @@ INSERT INTO a SELECT * FROM a;
   </para>
 
 <programlisting>
+#include "postgres.h"
+
 #include "executor/spi.h"
+#include "utils/builtins.h"
 
 #ifdef PG_MODULE_MAGIC
 PG_MODULE_MAGIC;
index 4bc45dc17f82c450dce039fccbc1b23a5038b442..5391dcb6e9b483ad3fe2e7ba89dcac0159198337 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.204 2009/01/02 20:42:00 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.205 2009/01/07 13:44:36 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #include "access/printtup.h"
 #include "access/sysattr.h"
+#include "access/xact.h"
 #include "catalog/heap.h"
+#include "catalog/pg_type.h"
 #include "commands/trigger.h"
+#include "executor/executor.h"
 #include "executor/spi_priv.h"
+#include "tcop/pquery.h"
+#include "tcop/utility.h"
+#include "utils/builtins.h"
+#include "utils/datum.h"
 #include "utils/lsyscache.h"
 #include "utils/memutils.h"
 #include "utils/snapmgr.h"
+#include "utils/syscache.h"
 #include "utils/typcache.h"
 
 
index 97d6d6c5e39a02a8bf70486e3d28eaa8f0eb97b6..53b9c43f081246c4bb1f30343d2d1dd6b71fb8c1 100644 (file)
@@ -15,7 +15,7 @@
  *
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.111 2009/01/01 17:23:49 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.112 2009/01/07 13:44:36 tgl Exp $
  *
  * ----------
  */
 
 #include "postgres.h"
 
+#include "access/xact.h"
 #include "catalog/pg_constraint.h"
 #include "catalog/pg_operator.h"
+#include "catalog/pg_type.h"
 #include "commands/trigger.h"
 #include "executor/spi.h"
 #include "parser/parse_coerce.h"
 #include "parser/parse_relation.h"
 #include "miscadmin.h"
 #include "utils/acl.h"
+#include "utils/builtins.h"
 #include "utils/fmgroids.h"
+#include "utils/guc.h"
 #include "utils/lsyscache.h"
 #include "utils/memutils.h"
 #include "utils/snapmgr.h"
+#include "utils/syscache.h"
 #include "utils/tqual.h"
 
 
index 43cfcb284ee41d498f09e0974d04b9c97deaa83c..845b1bf96a25aacfd2ed04ac897e9793e9488860 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.294 2009/01/01 17:23:50 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.295 2009/01/07 13:44:36 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "catalog/pg_authid.h"
 #include "catalog/pg_constraint.h"
 #include "catalog/pg_depend.h"
+#include "catalog/pg_language.h"
 #include "catalog/pg_opclass.h"
 #include "catalog/pg_operator.h"
+#include "catalog/pg_proc.h"
 #include "catalog/pg_trigger.h"
+#include "catalog/pg_type.h"
 #include "commands/defrem.h"
 #include "commands/tablespace.h"
 #include "executor/spi.h"
 #include "rewrite/rewriteHandler.h"
 #include "rewrite/rewriteManip.h"
 #include "rewrite/rewriteSupport.h"
+#include "utils/array.h"
+#include "utils/builtins.h"
 #include "utils/fmgroids.h"
 #include "utils/lsyscache.h"
 #include "utils/tqual.h"
+#include "utils/syscache.h"
 #include "utils/typcache.h"
 #include "utils/xml.h"
 
index 25d42ae29598c098d70d41f59fed52e5b9cd50c7..22db8609f3ac0860b6b50abc7c617dce732eb65e 100644 (file)
@@ -7,17 +7,19 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_rewrite.c,v 1.13 2009/01/01 17:23:50 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_rewrite.c,v 1.14 2009/01/07 13:44:36 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #include "postgres.h"
 
+#include "catalog/pg_type.h"
 #include "executor/spi.h"
+#include "miscadmin.h"
 #include "tsearch/ts_type.h"
 #include "tsearch/ts_utils.h"
-#include "miscadmin.h"
+#include "utils/builtins.h"
 
 
 static int
index f63dad7a3b934e58695bdda2f6c342fc91ba964f..27cef9a89c7b8818514fad841835efc33d8a2e3a 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/tsvector_op.c,v 1.20 2009/01/01 17:23:50 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/tsvector_op.c,v 1.21 2009/01/07 13:44:36 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -15,6 +15,7 @@
 #include "postgres.h"
 
 #include "catalog/namespace.h"
+#include "catalog/pg_type.h"
 #include "commands/trigger.h"
 #include "executor/spi.h"
 #include "funcapi.h"
index bf0bd92b2f7f6b53bc1dbb489d1c34a122c1ab68..fcfc05ba5155900b7d9821fdfca218029e98d451 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.82 2009/01/01 17:23:50 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.83 2009/01/07 13:44:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -81,6 +81,7 @@
 #include "utils/datetime.h"
 #include "utils/lsyscache.h"
 #include "utils/memutils.h"
+#include "utils/syscache.h"
 #include "utils/xml.h"
 
 
index 7966fe3dc1cd4cc9f1337bd10de28db46ad856d8..c28730c425bad306f5bcdd3396d3f1b5c08ffde3 100644 (file)
@@ -6,44 +6,17 @@
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.68 2009/01/01 17:23:59 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.69 2009/01/07 13:44:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef SPI_H
 #define SPI_H
 
-/*
- * This file may be used by client modules that haven't already
- * included postgres.h
- */
-#include "postgres.h"
-
-/*
- *     Most of these are not needed by this file, but may be used by
- *     user-written code that uses SPI
- */
-#include "access/heapam.h"
-#include "access/xact.h"
-#include "catalog/pg_language.h"
-#include "catalog/pg_proc.h"
-#include "catalog/pg_type.h"
-#include "executor/execdefs.h"
-#include "executor/executor.h"
-#include "nodes/execnodes.h"
-#include "nodes/params.h"
 #include "nodes/parsenodes.h"
-#include "nodes/plannodes.h"
-#include "nodes/primnodes.h"
-#include "nodes/relation.h"
-#include "tcop/dest.h"
-#include "tcop/pquery.h"
-#include "tcop/tcopprot.h"
-#include "tcop/utility.h"
-#include "utils/builtins.h"
-#include "utils/datum.h"
 #include "utils/portal.h"
-#include "utils/syscache.h"
+#include "utils/relcache.h"
+#include "utils/snapshot.h"
 
 
 typedef struct SPITupleTable
index e2df129f52b59a8e2e30352508dfe887823cf39a..8dcbf09a48c2c1b50e3b6459e0a3d7f589885b15 100644 (file)
@@ -1,7 +1,7 @@
 /**********************************************************************
  * plperl.c - perl as a procedural language for PostgreSQL
  *
- *       $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.143 2008/12/11 07:34:09 petere Exp $
+ *       $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.144 2009/01/07 13:44:37 tgl Exp $
  *
  **********************************************************************/
 
 #include <locale.h>
 
 /* postgreSQL stuff */
+#include "access/xact.h"
+#include "catalog/pg_language.h"
+#include "catalog/pg_proc.h"
+#include "catalog/pg_type.h"
 #include "commands/trigger.h"
 #include "executor/spi.h"
 #include "funcapi.h"
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "parser/parse_type.h"
+#include "utils/builtins.h"
 #include "utils/fmgroids.h"
 #include "utils/guc.h"
+#include "utils/hsearch.h"
 #include "utils/lsyscache.h"
 #include "utils/memutils.h"
+#include "utils/syscache.h"
 #include "utils/typcache.h"
-#include "utils/hsearch.h"
 
 /* define our text domain for translations */
 #undef TEXTDOMAIN
index 71e86c9b6d3e4672ffc4c78492a0e3c5221c4302..7ae3536754d5af925c7e8973c1c6e4874d664423 100644 (file)
@@ -9,13 +9,14 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.118 2009/01/01 17:24:03 momjian Exp $
+ *       $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.119 2009/01/07 13:44:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #include "plpgsql.h"
 
+#include "catalog/pg_type.h"
 #include "parser/parser.h"
 
 
index 4983da1b4551faab835a7e5f6dd414fe912ca7dc..04eb52bdc3fc68922a162693c6635f4a7e7cd3e9 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.226 2009/01/01 17:24:03 momjian Exp $
+ *       $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.227 2009/01/07 13:44:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -27,6 +27,7 @@
 #include "tcop/tcopprot.h"
 #include "utils/array.h"
 #include "utils/builtins.h"
+#include "utils/datum.h"
 #include "utils/lsyscache.h"
 #include "utils/memutils.h"
 #include "utils/snapmgr.h"
index 973bc032a208b84897feffa047a0690560d6fdb1..f7c8b5b04dea5e921a250650da195e6a8322b9b9 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.107 2009/01/01 17:24:04 momjian Exp $
+ *       $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.108 2009/01/07 13:44:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,6 +18,7 @@
 
 #include "postgres.h"
 
+#include "access/xact.h"
 #include "fmgr.h"
 #include "miscadmin.h"
 #include "commands/trigger.h"
index f71af5c7257b8a3be3518ba217621c68abdeeadd..3f5e32e52ebf782f164c6a21b2d9b3fda8125118 100644 (file)
@@ -2,7 +2,7 @@
  * pltcl.c             - PostgreSQL support for Tcl as
  *                               procedural language (PL)
  *
- *       $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.124 2008/12/11 07:34:09 petere Exp $
+ *       $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.125 2009/01/07 13:44:37 tgl Exp $
  *
  **********************************************************************/
 
 #define CONST84
 #endif
 
+#include "access/xact.h"
 #include "catalog/pg_language.h"
 #include "catalog/pg_proc.h"
+#include "catalog/pg_type.h"
 #include "commands/trigger.h"
 #include "executor/spi.h"
 #include "fmgr.h"
@@ -33,6 +35,7 @@
 #include "utils/syscache.h"
 #include "utils/typcache.h"
 
+
 #define HAVE_TCL_VERSION(maj,min) \
        ((TCL_MAJOR_VERSION > maj) || \
         (TCL_MAJOR_VERSION == maj && TCL_MINOR_VERSION >= min))
index c5ea947f84e3a6388d681d0fd02a10e917e40017..ffbe4e37b8338e5f4f11eaf108e79fc0ddd3e21a 100644 (file)
@@ -1,15 +1,22 @@
 /*
- * $PostgreSQL: pgsql/src/test/regress/regress.c,v 1.71 2008/03/25 22:42:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/test/regress/regress.c,v 1.72 2009/01/07 13:44:37 tgl Exp $
  */
 
 #include "postgres.h"
 
-#include <float.h>                             /* faked on sunos */
+#include <float.h>
+#include <math.h>
 
 #include "access/transam.h"
-#include "utils/geo_decls.h"   /* includes <math.h> */
-#include "executor/executor.h" /* For GetAttributeByName */
-#include "commands/sequence.h" /* for nextval() */
+#include "access/xact.h"
+#include "catalog/pg_type.h"
+#include "commands/sequence.h"
+#include "commands/trigger.h"
+#include "executor/executor.h"
+#include "executor/spi.h"
+#include "utils/builtins.h"
+#include "utils/geo_decls.h"
+
 
 #define P_MAXDIG 12
 #define LDELIM                 '('
@@ -325,8 +332,6 @@ oldstyle_length(int n, text *t)
        return n + len;
 }
 
-#include "executor/spi.h"              /* this is what you need to work with SPI */
-#include "commands/trigger.h"  /* -"- and triggers */
 
 static TransactionId fd17b_xid = InvalidTransactionId;
 static TransactionId fd17a_xid = InvalidTransactionId;