8000 Fix executor/spi.h to follow our usual conventions for include files,… · postgrespro/postgres_cluster@1cfd9e8 · GitHub
[go: up one dir, main page]

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
  • utils/adt
  • include/executor
  • pl
  • test/regress
  • 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

    src/backend/utils/adt/ri_triggers.c

    Lines changed: 6 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -15,7 +15,7 @@
    1515
    *
    1616
    * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
    1717
    *
    18-
    * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.111 2009/01/01 17:23:49 momjian Exp $
    18+
    * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.112 2009/01/07 13:44:36 tgl Exp $
    1919
    *
    2020
    * ----------
    2121
    */
    @@ -30,18 +30,23 @@
    3030

    3131
    #include "postgres.h"
    3232

    33+
    #include "access/xact.h"
    3334
    #include "catalog/pg_constraint.h"
    3435
    #include "catalog/pg_operator.h"
    36+
    #include "catalog/pg_type.h"
    3537
    #include "commands/trigger.h"
    3638
    #include "executor/spi.h"
    3739
    #include "parser/parse_coerce.h"
    3840
    #include "parser/parse_relation.h"
    3941
    #include "miscadmin.h"
    4042
    #include "utils/acl.h"
    43+
    #include "utils/builtins.h"
    4144
    #include "utils/fmgroids.h"
    45+
    #include "utils/guc.h"
    4246
    #include "utils/lsyscache.h"
    4347
    #include "utils/memutils.h"
    4448
    #include "utils/snapmgr.h"
    49+
    #include "utils/syscache.h"
    4550
    #include "utils/tqual.h"
    4651

    4752

    src/backend/utils/adt/ruleutils.c

    Lines changed: 7 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -9,7 +9,7 @@
    99
    *
    1010
    *
    1111
    * IDENTIFICATION
    12-
    * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.294 2009/01/01 17:23:50 momjian Exp $
    12+
    * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.295 2009/01/07 13:44:36 tgl Exp $
    1313
    *
    1414
    *-------------------------------------------------------------------------
    1515
    */
    @@ -25,9 +25,12 @@
    2525
    #include "catalog/pg_authid.h"
    2626
    #include "catalog/pg_constraint.h"
    2727
    #include "catalog/pg_depend.h"
    28+
    #include "catalog/pg_language.h"
    2829
    #include "catalog/pg_opclass.h"
    2930
    #include "catalog/pg_operator.h"
    31+
    #include "catalog/pg_proc.h"
    3032
    #include "catalog/pg_trigger.h"
    33+
    #include "catalog/pg_type.h"
    3134
    #include "commands/defrem.h"
    3235
    #include "commands/tablespace.h"
    3336
    #include "executor/spi.h"
    @@ -44,9 +47,12 @@
    4447
    #include "rewrite/rewriteHandler.h"
    4548
    #include "rewrite/rewriteManip.h"
    4649
    #include "rewrite/rewriteSupport.h"
    50+
    #include "utils/array.h"
    51+
    #include "utils/builtins.h"
    4752
    #include "utils/fmgroids.h"
    4853
    #include "utils/lsyscache.h"
    4954
    #include "utils/tqual.h"
    55+
    #include "utils/syscache.h"
    5056
    #include "utils/typcache.h"
    5157
    #include "utils/xml.h"
    5258

    src/backend/utils/adt/tsquery_rewrite.c

    Lines changed: 4 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -7,17 +7,19 @@
    77
    *
    88
    *
    99
    * IDENTIFICATION
    10-
    * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_rewrite.c,v 1.13 2009/01/01 17:23:50 momjian Exp $
    10+
    * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_rewrite.c,v 1.14 2009/01/07 13:44:36 tgl Exp $
    1111
    *
    1212
    *-------------------------------------------------------------------------
    1313
    */
    1414

    1515
    #include "postgres.h"
    1616

    17+
    #include "catalog/pg_type.h"
    1718
    #include "executor/spi.h"
    19+
    #include "miscadmin.h"
    1820
    #include "tsearch/ts_type.h"
    1921
    #include "tsearch/ts_utils.h"
    20-
    #include "miscadmin.h"
    22+
    #include "utils/builtins.h"
    2123

    2224

    2325
    static int

    src/backend/utils/adt/tsvector_op.c

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -7,14 +7,15 @@
    77
    *
    88
    *
    99
    * IDENTIFICATION
    10-
    * $PostgreSQL: pgsql/src/backend/utils/adt/tsvector_op.c,v 1.20 2009/01/01 17:23:50 momjian Exp $
    10+
    * $PostgreSQL: pgsql/src/backend/utils/adt/tsvector_op.c,v 1.21 2009/01/07 13:44:36 tgl Exp $
    1111
    *
    1212
    *-------------------------------------------------------------------------
    1313
    */
    1414

    1515
    #include "postgres.h"
    1616

    1717
    #include "catalog/namespace.h"
    18+
    #include "catalog/pg_type.h"
    1819
    #include "commands/trigger.h"
    1920
    #include "executor/spi.h"
    2021
    #include "funcapi.h"

    src/backend/utils/adt/xml.c

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -7,7 +7,7 @@
    77
    * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
    88
    * Portions Copyright (c) 1994, Regents of the University of California
    99
    *
    10-
    * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.82 2009/01/01 17:23:50 momjian Exp $
    10+
    * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.83 2009/01/07 13:44:37 tgl Exp $
    1111
    *
    1212
    *-------------------------------------------------------------------------
    1313
    */
    @@ -81,6 +81,7 @@
    8181
    #include "utils/datetime.h"
    8282
    #include "utils/lsyscache.h"
    8383
    #include "utils/memutils.h"
    84+
    #include "utils/syscache.h"
    8485
    #include "utils/xml.h"
    8586

    8687

    src/include/executor/spi.h

    Lines changed: 3 additions & 30 deletions
    Original file line numberDiff line numberDiff line change
    @@ -6,44 +6,17 @@
    66
    * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
    77
    * Portions Copyright (c) 1994, Regents of the University of California
    88
    *
    9-
    * $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.68 2009/01/01 17:23:59 momjian Exp $
    9+
    * $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.69 2009/01/07 13:44:37 tgl Exp $
    1010
    *
    1111
    *-------------------------------------------------------------------------
    1212
    */
    1313
    #ifndef SPI_H
    1414
    #define SPI_H
    1515

    16-
    /*
    17-
    * This file may be used by client modules that haven't already
    18-
    * included postgres.h
    19-
    */
    20-
    #include "postgres.h"
    21-
    22-
    /*
    23-
    * Most of these are not needed by this file, but may be used by
    24-
    * user-written code that uses SPI
    25-
    */
    26-
    #include "access/heapam.h"
    27-
    #include "access/xact.h"
    28-
    #include "catalog/pg_language.h"
    29-
    #include "catalog/pg_proc.h"
    30-
    #include "catalog/pg_type.h"
    31-
    #include "executor/execdefs.h"
    32-
    #include "executor/executor.h"
    33-
    #include "nodes/execnodes.h"
    34-
    #include "nodes/params.h"
    3516
    #include "nodes/parsenodes.h"
    36-
    #include "nodes/plannodes.h"
    37-
    #include "nodes/primnodes.h"
    38-
    #include "nodes/relation.h"
    39-
    #include "tcop/dest.h"
    40-
    #include "tcop/pquery.h"
    41-
    #include "tcop/tcopprot.h"
    42-
    #include "tcop/utility.h"
    43-
    #include "utils/builtins.h"
    44-
    #include "utils/datum.h"
    4517
    #include "utils/portal.h"
    46-
    #include "utils/syscache.h"
    18+
    #include "utils/relcache.h"
    19+
    #include "utils/snapshot.h"
    4720

    4821

    4922
    typedef struct SPITupleTable

    0 commit comments

    Comments
     (0)
    0